@automattic/wpcom-checkout
Version:
Functions and components used by WordPress.com checkout.
15 lines • 760 B
TypeScript
import type { ResponseCart, ResponseCartProduct } from '@automattic/shopping-cart';
/**
* Check if a cart item can be removed from the cart.
*
* If this returns false, there will be no option to remove the specified
* product from the cart.
*
* Please use this sparingly; it's often better to add guards inside the
* shopping-cart endpoint on the backend rather than here. Not being shown any
* way to remove an item from the cart can be very confusing for users. If you
* add a guard in the shopping-cart endpoint instead, it can return an error
* message to explain why.
*/
export declare function canItemBeRemovedFromCart(item: ResponseCartProduct, responseCart: ResponseCart): boolean;
//# sourceMappingURL=can-item-be-removed-from-cart.d.ts.map