How to update a cart Item with price or any other property in v2


#1

https://docs.moltin.com/checkout-flow/cart#update-an-item-in-a-cart

I am trying to update the price property in the cart item using above link, but doesn’t seem much helpful. I tried referencing the sample payload and request but Its giving me 401 error.

help please.


#2

Hey @rushikesh :wave:

You won’t be able to update the price of items in the cart directly using a PUT. That is generally only available to update the quantity of items.

Depending on why you want to need to reduce the price of a cart item, there are a couple of methods you could try.

Is it a promotional discount?


#3

I have a discount logic ready which calculates as per a logic/price and I need to update it in the cart.
No its not a promotional discount. I have made a discount coupon code which when applied will give 20% of discount on the price value. So I have the calculations ready, just need to update that in the cart So that user gets the discounted value.


#4

Can I get some help on this? What are the other methods I can try.


#5

We actually have a promotions service that is a work in progress. However unfortunately right now its not publicly available :disappointed:

There are a couple of potential (ugly) workarounds for the time being:

  1. Have a duplicate of each product in your inventory with the desired discounted price(s).
  2. Use custom cart items to simulate the product in your cart, with the desired reduced cost.

Neither of these workarounds are ideal and we’d recommend waiting out for a release of the promotions service in the very near future. Once the service is live, you’ll be able to reduce the cart total by a fixed amount, or by a percentage (like you need).

I hope this helps answer your query :smile:


#6

Sounds good for now.Thanks! will try this.