Shopify Flow Send HTTP Request on /cart/clear

Shopify Flow Send HTTP Request on /cart/clear

yakishiba
Shopify Partner
4 0 1

I'm trying to clear a user's cart when they abandon their checkout by closing the tab or navigating to another website url during the checkout flow. As an aside, in our store (Shopify Plus), the user doesn't actually make it to the /cart page as we take them straight to checkout. 

In Flow, the Send HTTP Request block is filled out like this:

yakishiba_0-1736964217976.png

I understand that the /cart/clear api is unauthenticated and doesn't need any additional headers or data in the body. When the conditions are met, the Flow passes and even the Send HTTP Request succeeds. However, for the customer, if they are on our website and refresh the browser, the Cart icon still shows that there is quantity from their previous checkout; further, the customer could proceed with their previous abandoned checkout along with the same item quantity still in their cart. What am I doing wrong? Suggestions and feedback are welcome.






Replies 5 (5)

paul_n
Shopify Staff
1818 199 432

Not sure what API you are calling there but if you are redirecting to a shopify API, you might have better luck asking in a more general API topic on the community. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

Yuka
Shopify Partner
14 1 0

If you want to use authentication in a request, you can use the Send HTTP request action from the Flow Companion app. This action allows you to configure authentication in several ways.

CleanShot 2025-01-16 at 17.36.07.png

yakishiba
Shopify Partner
4 0 1

Hi Yuka! I've already attempted to do that, but it doesn't seem to work. Based off observation, the user's cart is cleared if they visit the /cart/clear url directly, or if they click a button on the frontend that directs them to that url. Honestly, I feel like it *should* work with the Send HTTP Request Flow action, but I've tested countless runs and it never clears the cart.

paul_n
Shopify Staff
1818 199 432

Use something like Postman to figure out the API call details first as it will enable more rapid experimentation and visibility into issues

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
yakishiba
Shopify Partner
4 0 1

Thanks for the tip! Also, for those wondering what the AJAX api requirements are:

  • This is an unauthenticated API. It doesn’t require access tokens or a client ID to access.
  • There are no hard rate limits on the Ajax API. It’s still subject to Shopify’s standard API abuse-prevention measures.
  • All API responses return JSON-formatted data.
  • Product JSON responses are limited to a maximum of 100 variants.
  • The Ajax API can’t be used to read any customer or order data, or update any store data. If you need more extensive access, check the GraphQL Admin API.