Send Changed Price To Cart Page In Shopify

- 1 answer

I'm new to shopify and meet this issue.

Let's assume that you owned a printing company and build the website.

Every printing has its own size.

So there is just only standard price for square cm, not for every variant.

So in product detail page if you input width and height then the price is automatically calculated using jquery now.

Then when I click add to cart button I want to send my price to cart page, but it shows default price on cart page for that product.

How can I do this?

I tried to using Shopify Ajax but it's not working.

Any help would be appreciate.



You calculate how many units your customer wants multiplying length times width. That is a number. Say 12 x 12 for something. It costs $1.62 per square unit. You add variant ID 123456789xyz to the cart with a POST using either typical form submit OR equally valid, an ajax POST, with the quantity set to 144 and the variant ID. It works perfect. I have done that pattern for millions of dollars in sales with Shopify.

So the lesson for you is not to send the price to the cart, but instead, the variant ID and the quantity. Price is taken care of internal to Shopify and you cannot monkey with that.