Hi all,
A bit of background - we have a Shopify Plus store with access to checkout.liquid. Our setup is headless so the frontend is a separate React app. We’re wanting to incorporate an upsell widget in the checkout so that customers can add extra products before checking out. Something to note: our frontend currently uses the Storefront API to create/mutate a checkout when a customer adds items to their cart, because when we implemented it there was no cart object available in the Storefront API.
The problem:
When we try to add items to the cart via the Ajax API or Storefront API (using cart mutations), they seem to get added to a different cart than the one that is associated with the checkout, so when navigating to the next step or refreshing the page the added items don’t appear.
What we’ve tried:
-
Added to cart from within the checkout via Ajax API. The requests worked fine but they seemed to add items to a cart that was not associated with the checkout.
-
On the frontend we tried to create a new cart via Storefront API, used the checkoutUrl to navigate to checkout, added more items to that same cart via Storefront API from within the checkout. Once again the requests worked fine but items still don’t appear in the checkout after refresh or navigation to next step.
Is there a way to achieve this? I could potentially use the Storefront API to mutate the actual checkout but there doesn’t seem to be a way of getting the checkoutId from within the checkout. Am I missing something?
Any help would be much appreciated, thanks!