Development discussions around Shopify APIs
Hi,
We have created a public app to help Shopify store owners to allow their customers to buy products and the price is dynamically calculated at the time of the checkout process based on the inputs entered on the page. For this, we use the Shopify public API to create a new variant with the dynamically calculated price. However, we do see that when we create a new variant using API and then to the cart, the price on the cart page shows the price as $0 and no image for up to 10-15 seconds. Then if we refresh that page couple of times, it shows the correct price. It seems like a delay in the system somewhere from the time when the variant is created and when that information is available on the store front end.
Is there a solution to this or any recommendations?
But how do you handle cart subtotal? Line item price is still zero so the cart subtotal might not be correct
@SanaMinatozaki
What I do after replacing all the missing prices is to get all the item prices, total them, fix price formatting and replace the original subtotal with the new total using DOM manipulation.
Also, when the user goes to actually check out, the car page will hang and load until all of the correct pricing has been completely added to the cart so you will never have an instance where a customer can checkout with a zero-priced item.
Even I try to use GraphQL (product variant create) to create the new variant. It still takes a long time to show the correct data on the cart page.
Hope Shopify can improve it. It's the backend issue that app developers cannot control. And it's seriously affecting the conversion rate on the cart page
@NagoyaDev In another of your posts, you mentioned that @PaulNewton 's method would work although you didn't try it.
I've read his post but couldn't understand. Can you elaborate on this one?
@SanaMinatozaki if you mean my post about a dummy product it's just that, create an unpublish product with placeholder data.
When the custom stuff comes in push that the existing dummy product basically skipping waiting on a roundtrip if you were to create everything at once.
Never seen if it's done in the wild though since its kinda the reverse of what a lot of apps and customizations do: a dummy cart , or loader preventing checkout until the product is ready.
@sagarkohli I actually based my app around the functionality of this app and actually yes you do need to wait 10-20 seconds when you use it.
The app will actually console log how long it takes and the three times I tested it, they all took about 15 seconds
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023