Change product price on the fly in cart?

Zelf
Shopify Partner
33 0 11

Is it possible to change an existing product's price on the fly in the cart?

 

Can this be done using the Shopify Ajax API or some other API?

0 Likes
_JB
Shopify Staff
Shopify Staff
834 99 189

Hey @Zelf,

 

It's not currently possible to change the product price from the storefront using AJAX. The admin API can be used to update product pricing, but this isn't necessarily meant to update pricing on-the-fly, since product pricing will be preserved for a short time if a customer enters the checkout with that item. 

 

If you detail what you're looking to build, I'd be happy to offer some suggestions.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Zelf
Shopify Partner
33 0 11

We manufacture custom products from variants the user selects in our app. They can select from literally 1,000's of product combinations. In other platforms this would be considered a configurable product or a bundled product. Shopify, however, has a limitation on how many variants a single product can have, so we cannot go down this road.

 

Currently, we dump the user's product selections into the Shopify Cart via the Shopify Ajax API, but they are line items. This works just fine, but for marketing purposes we need to have a single product SKU/Barcode/GTIN that we could call e.g. "Your Manufactured Product", which would be the cumulative price of all of the products they have selected that ultimately will become one final, but unique product after manufacturing. The end goal is to have one product that user's can review.

 

Likely, the answer is Shopify just can't do this, but I wanted to ask. I know we could create through the Shopify Admin API a short lived product and give these products any price we want, but then we would litter our Shopify store with 1,000's of these short lived custom products every day and need to implement garbage cleanup. This would be messy.

 

Having the ability to have one product and adjust the price in the cart for the user's sessions only, using the Shopify Ajax API, but not the actual product in admin would solve this issue for us.

ffernandez
New Member
1 0 0

I Would like to do the same thing.

If the cart API could change the price, it would be easy to manipulate the price of products and not necessarily create new products

0 Likes