Why is the Ajax API causing slow 'add to cart' action on my store?

Why is the Ajax API causing slow 'add to cart' action on my store?

oliviermsb
Shopify Partner
1 0 0

Hello,

 

We are facing slow "add to cart" action with our store.

 

We have customized Shopify to integrate our custom book editor and use the "Ajax API" to allow our users to add products to their cards before redirecting them to the basket page.


We found out that it can take up to 15 seconds for an added product to appear in the cart.


To add a product to our customer basket, we use the AJAX API

What we do is the following:
- We call "add to cart" (https://shopify.dev/api/ajax/reference/cart#post-locale-cart-add-js)
- then we check every 5 seconds if the product is in the cart (https://shopify.dev/api/ajax/reference/cart#get-locale-cart-js)
- We redirect to the basket

 

We noticed that the product can take up to ~15 seconds to appear in the basket.

We think it's a performance issue on the Shopify API side, does anyone experience the same behavior?

 

We wonder if it's not related to the large number of products we have (1 customized book = 1 unique Shopify product)

 

Thank you in advance,

 

Olivier

Reply 1 (1)

Cedcommerce
Shopify Partner
718 77 116

Hello @oliviermsb,

 

There might be an issue with the theme code or some other code-related issue because if you are using Ajax API we can add products to the cart within 3-4 secs.

 

Ask your developer to fix this issue.

 

Let us know if you need any further help.

 

All the best, 

CedCommerce

CedCommerce || Shopify Expert
- Let us know if our reply is helpful for you. Like it.
- Was your question answered? Mark it as an accepted solution.
- For further discussion contact: Email ID- apps@cedcommerce.com
- Whatsapp:- Join Here