• Resolved kmcwepc

    (@kmcwepc)


    I have a php code that renders a booking form using the shortcode “(getpaid item=<itemID>|<qty>)”, where the item ID and quantity are determined programmatically. I want to be able to apply a discount to the cart as it’s rendered. One option would be to create a randomly generated discount code for the amount, publish it, then use JavaScript to populate the discount code field. But I’d like to avoid doing that, and simply adjust the final price for this current session alone without creating a discount code. How can I do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter kmcwepc

    (@kmcwepc)

    Or alternatively, override the price of a single unit of an item (but allow it to be added multiple times with different prices). Maybe I should explain my usecase/goal. Let’s say I want to sell tickets for an event. I need to have a single item as the ticket so that stock levels work, but I need to allow different rates, e.g. child, unwaged, member, etc. So is there a way to add an item multiple times to the cart, but at different prices?

    Plugin Contributor Brian Mutende

    (@picocodes)

    It is not possible to add an item multiple times to the same cart. For your tickets use case, you can create a different item for each ticket type.

    I’ve added a feature request to allow adjusting an item’s price via the shortcode.

    You can monitor progress here:- https://github.com/AyeCode/invoicing/issues/753

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to programmatically apply a one-time cart discount to the current session’ is closed to new replies.