Shopify / js-buy-sdk

The JS Buy SDK is a lightweight library that allows you to build ecommerce into any website. It is based on Shopify's API and provides the ability to retrieve products and collections from your shop, add products to a cart, and checkout.

Home Page:https://shopify.github.io/js-buy-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

checkout fetch / API does not update line item title or subtotal in checkout session if items are changed once already in a cart

leemethvenmtc opened this issue · comments

Hi,

OS: WIndows
Browser: Chrome (but happens on them all)
SDK Version: Latest as of this post

We're having an issue where when we've added a line item / product to a "cart" / checkout session, if that item's title or price is updated in Shopify, a reload of the page does not fetch the new item title and the cart / checkout subtotal goes out of sync - although the line item price updates properly.

On each load we are fetching checkout using the client.checkout.fetch() method, unfortunately it appears like the data (cart subtotal, item titles) are being cached Shopify side, which is causing the above issue, which is out of date product names and overall subtotal / cart price.

The only way to get the checkout session or cart to update is to visit the checkout and when it fixes itself there, it then pulls through the checkout session via the fetch method correctly.

Here's a video recording showing the issue: https://leemtc.tinytake.com/msc/NjkwNTg1Nl8xOTU4ODQ1MA

We had the same issue with the BuyButton.js library before and were hoping it would not be a problem with the SDK approach, but unfortunately it's resurfaced.

Is there anything we can do via the Buy SDK to force this functionality / a total refresh of checkout session?

Thanks,
Lee