INNER CODE UNIT · JavaScript

dispatchCartItemAction

CrystallizeAPI/crystallize-nextjs-boilerplate · src/components/basket/index.js:129

  function dispatchCartItemAction(action) {
    return (data) => dispatch({ action, ...data });
  }

  function withLocalState(item) {
    // Exclude voucher codes
    if (item.sku.startsWith('--voucher--')) {
      return item;
    }

    const clientBasketCartItem = clientBasket.cart.find(
      (c) => c.sku === item.sku
    );

    /**
     * Don't show the cart item if it is not in
     * the client cache.
     **/

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…