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?
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.
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.
@sillycube I guess it depends on your use case. Did you find a better way?
Currently, I am also using a spinner to wait for Shopify. My use case is using new variants to adjust prices. I'm researching whether I can use a discount instead.
The current way is just too buggy but there is no way to improve it. And I get user complaints every day
@sillycube well of course you would use a spinner, otherwise your problem is just UX. I was wondering if you found a better way to do this programmatically with the API. But doesn't seem like it.
How long are your intervals set for? 15 seconds seems like a really long time.
Yes, this methodology works but has defects. Therefore, I can only look for another way to do the same thing. This API issue has been existing for a while. I don't think Shopify is willing to solve it in the near future.
Also, I've to set the inventory policy to CONTINUE when creating the variants. This is not desirable but I have no choice.
I am using ~8s, 15s is safe but not tolerable IMO. You can try to redirect the customers to the checkout page. Just another UX hack
Have you created a collection on your online store and experienced an issue with adding yo...By Ollie Aug 24, 2022
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...By Ollie Jul 28, 2022