INNER CODE UNIT · JavaScript

withLocalState

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

  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.
     **/
    if (!clientBasketCartItem) {
      return null;
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…