hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

"Add to bag" & cart dynamic states

Open mynameisadamf opened this issue 3 years ago • 3 comments

Motivation

Right now there is a pause when an item is added to the bag. On slower networks (3g) the pause is about 5+ seconds. In relation we do do provide any feedback in the cart when quantity has been increased or decreased as there is a pause as well before the total is updated.

Opportunity

Always provide feedback to the shopper that something is happening on the backend. Even with optimistic UI that happens instant, we should show validations of successfully added and remove

Brainstorm features & functionality:

  • Add to bag button, reads "adding..." or "adding to bag..." loader OR Just loading animation
  • Checkmark confirmation when added to card "Added ✓" on add to bag button
  • Remove from cart validation in cart
  • Quantity change loader in cart

mynameisadamf avatar Oct 21 '22 19:10 mynameisadamf

@mynameisadamf could you add some more details to this?

blittle avatar Oct 27 '22 21:10 blittle

@blittle dropped in some initial thoughts around this.

mynameisadamf avatar Oct 31 '22 22:10 mynameisadamf

Any updates on this? Or at least is there a workaround to show loading states when making cart changes?

mhmdjaw avatar Apr 21 '24 15:04 mhmdjaw

This is resolved with the new useOptimisticCart() hook: https://github.com/Shopify/hydrogen/blob/main/packages/hydrogen/src/cart/optimistic/useOptimisticCart.tsx

blittle avatar May 28 '24 20:05 blittle