payload icon indicating copy to clipboard operation
payload copied to clipboard

feat(plugin-ecommerce): expose method refreshCart in useCart (#14765)

Open teastudiopl opened this issue 3 months ago • 0 comments

What?

This PR adds a new method refreshCart to the E-commerce plugin.

Why?

Currently, the standard addItem method enforces uniqueness validation for products in the cart. This conflicts with certain use cases where the same product should be added as a new line item.

By exposing refreshCart, developers can manually refresh the cart state after directly modifying cart items, ensuring the UI stays in sync without being blocked by addItem’s uniqueness validation.

This addresses the feature request described in #14765 and the related discussion #14764 .

How?

Added refreshCart method to the E-commerce context.

This allows programmatic updates to the cart state without triggering the uniqueness validation of addItem.

The method can be called after direct modifications to the cart (e.g., via fetch requests or custom logic).

Fixes

Fixes #14765

teastudiopl avatar Nov 30 '25 18:11 teastudiopl