Horizon removes cart items from the UI before Shopify confirms the removal succeeded

Short description of issue

Horizon removes cart items from the UI before Shopify confirms the removal succeeded

Reproduction steps

  1. Use the Horizon theme.
  2. Add a product to the cart.
  3. Have a Cart Validation Function reject removal of that cart line item.
  4. Go to the cart page (/cart) or open the cart drawer.
  5. Click the remove button on the line item.

The item immediately disappears from the Horizon cart UI before the /cart/change request has completed.

When Shopify rejects the change, the item remains in the actual cart, but Horizon does not restore it in the UI.

Refreshing the cart/page causes the item to appear again.

Additional info

I consider this a bug. The vast majority of theme store themes wait for confirmation of removal and if there is an error, they show that error beside the remove button or somewhere within the cart line item.

A few themes don’t catch the error and instead it takes you to a Shopify error page that includes the message back from the validation function. That still works as the customer doesn’t incorrectly believe the item is gone, only to see it’s back once the page is refreshed or once the customer goes to checkout.

What type of topic is this

Bug report

Hi @gunner, thanks for the detailed reproduction steps. I was able to reproduce this and confirm that Horizon removes the item from the cart UI before the checking the response from the /cart/change request.

I’ve reported the issue internally. I can’t confirm when a fix will be available, but I’ll update this thread once it has been resolved.