Issue with useCartSubscription Hook Not Detecting Cart Item Removal in Shopify POS on cart screen

Hi, I’m using the POS extension version 9.30.1, and I came across a weird issue.

I’m using the useCartSubscription hook to listen for cart changes. However, the effect is not triggered when I remove a product from the cart screen.

Is there any other way to listen for cart item changes? The cart screen is handled by Shopify.

For reference, I’m attaching screenshots.

const cart = useCartSubscription();

useEffect(() => {
  console.log("Line item changed");
}, [cart.lineItems]);

//Cart screen

Hi @Hassan_Ahmed There was a recent issue around the cart subscription on first load. There is a fix available in POS 9.31.0 which you can download starting March 31.

Thank you
Victor

1 Like

Thanks @Victor_Chu , i will update this.

Hi @Hassan_Ahmed,
Could you please let me know which POS extension you used?
I’m trying to implement some functionality on the cart page, and I used POS UI Extension for Cart Line Item Details, but it’s not working as expected. It just shows a single tile in the POS dashboard with an error.

And also @Victor_Chu,
Can you guide me on how to properly add functionality when the cart page like show a toast message when the cart is opened?

Thanks in advance!