New variants show as free ($0.00) when added to the cart.

Highlighted
Shopify Partner
26 1 10

Hi everyone,

Has anyone had experience with this? New variants created right before adding to the cart are, most of the time, shown as free products for 20-30 seconds.

If you keep refreshing, eventually the image and correct price show. Until then, only the variant title is correct.

Unsure why the price and image would be unavailable straight away, since as the API returns all the correct information immediately?

0 Likes
Highlighted
Shopify Partner
72 6 14

Hey @BoxUp , yes! I have had this issue.

The best I could do was assume that while the variant number that is being added to the cart is valid, the Product object has not been updated with the data yet. So when the cart goes to find the information it isn't there, and subsequently, the cart's cache stores blank information for a period of time. This is my working theory, and happy (hopeful!) to be corrected about this. 

I was able to work around this, I used setInterval() to regularly query the Product object and when the new Variant id was present, then added it to the cart. A bit hackish I suppose, but it works in the real world.

I'm really keen to hear from anyone else who has faced this issue.

Was this helpful? Press like!
Did it fix the problem? Mark it as the solution for others!
Buy me a beer? Well, sure!
0 Likes
Highlighted
Shopify Partner
26 1 10

Hi @BStubbs 

Yeah, that's what we've ended up with for now. I don't imagine there's going to be much that can be done.

Thanks for your reply.

0 Likes