Same Item ID but different prices

This topic contains 5 replies, has 4 voices, and was last updated by  Patrik 1 year, 3 months ago.


  • Author
  • #3763

    Alison Teitel
    Free User
    Post count: 5

    I’m using wpinv_insert_invoice() to create my invoices. There are 5 different items, but each needs to be priced differently.

    So for example, let’s say I have 3 types of apples:

    Granny Smith
    Red Delicious

    Each time I invoice for my apples, I have different prices for them based on several factors. So let’s say I have three batches of Granny Smith apples.

    Batch 1 costs 7.50
    Batch 2 costs 10.50
    Batch 3 costs 5.50

    Now they are all the same item with the same item ID, but each has a custom price.

    My cart details array might look like this:

      array("id" => 24, "custom_price" => 7.50),
      array("id" => 24, "custom_price" => 10.50),
      array("id" => 24, "custom_price" => 5.50)

    Your ‘cart_items’ doesn’t work like this, since it just increments the quantity and takes the last custom price used so I end up with an invoice with one item.

    Granny Smith apples, quantity 3, price 5.50

    This won’t work for me, so what should I do?

    I’ve considered:

    Creating a brand new item, adding it to the invoice and then deleting the item, but I don’t think that will work since the invoice is based on the item code.

    What I don’t want is to create thousands of unique items with different custom prices.

    What can I do? This ground my development to a halt.


    Alex Rollin
    Post count: 27815

    The way Invoicing works, yes you will need separate items for those.


    Alison Teitel
    Free User
    Post count: 5

    Mark as resolved. I’ve made my modifications to work around this. Perhaps you could consider this as a feature request.


    Marco Michely
    Free User
    Post count: 8

    Hey @alison,
    i am in the same situation. I consider using WP Invoicing as an Agency where we need more flexible Invoice Items with individual descriptions and prices.

    Would you share your modifications or tell me if it is worth the effort?


    Marco Michely
    Free User
    Post count: 8
    This reply has been marked as private.

    Post count: 1971

    Hi Marco,

    Thanks for sharing ideas for enhancing our Invoicing plugin. We will consider those ideas for sure in future releases of the plugin or add ons. For now, we have other more priority work going on for this plugin.


Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Same Item ID but different prices’ is closed to new replies, this may be for inactivity, please open a new topic if you have a similar question.