All things Shopify and commerce
I'm dynamically creating product variants on Shopify using the Admin GraphQL API, and then immediately trying to add those variants to the cart using the /cart/add.js AJAX endpoint.
While the variant is technically created successfully and an ID is returned, it seems that Shopify takes several seconds (sometimes up to 30 seconds) to fully index the newly created variant and propagate it to the storefront/cart system.
As a result:
When I try to add the variant to the cart immediately after creation, the cart displays a broken line item:
No product image
No title
Variant properties are partially missing
Price is shown as 0.00 TL
If I refresh the cart page after 30 seconds, the product appears correctly with all the correct data.
This indicates that the variant was created successfully, but Shopify’s cart system did not recognize or fully sync the variant yet at the time it was added.
This only affects the very first few seconds after the variant creation — but it’s enough to result in broken cart UX and zero-priced items until the variant is indexed and visible through storefront APIs. We are using a public app that does the job for us and the variant is being added to the cart in 2-3 seconds. But what's the difference? The shop is www.etulle.com.tr, using the public app at the moment which works okay.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025