Home
Wiki
Home
Wiki
  1. 3. Reusables
  • Back to home
  • 1. Themes
  • Vs Code
    • Getting Started
  • Kitchenware
    • Layout
      • New Layout
      • Legacy Layout
    • Components
      • Announcement
      • Banner Carousel
      • Banner With Products Carousel
      • Blog Category List
      • Blog List
      • Brand List
      • Brands Carousel
      • Breadcrumb
      • Call To Action
      • Cart
      • Categories List
      • Change Password
      • Checkout
      • Cookie Manager
      • Filter list
      • Footer
      • Forgot Password
      • Form
      • Hero Carousel
      • Icon Block
      • Invitation
      • Last Visited Products
      • Layout
      • Login
      • Map
      • Nav Bar
      • Offer
      • Product Attachments
      • Product Attributes
      • Product Documentation
      • Product Expected
      • Product Modal
      • Products Block
      • Products Carousel
      • Product Single
      • Profile
      • Quote
      • Register
      • Related Products
      • Search
      • Stores
      • Subscribe Newsletter
      • Text with Image
      • Top Bar
      • Video
    • Reusables
      • Getting Started
    • Assets
      • Getting Started
    • SDK
      • Products
        • _findProductsByCategory
        • _findProductsByIds
        • _findProductsByTitle
        • _findProductsByFilter
        • _findProductsByCriteria
        • _findProductsAndCalculate
        • _findProductsThenCalculate
        • _getProductAttributeSet
        • _setLastVisited
      • Categories
        • _findCategoryTreeById
        • _findCategoriesByIds
        • _findCategoryByAlias
        • _findCategoryTreeByAlias
        • _getCategoryContent
      • Collections
        • _getCollectionContent
        • _findCollectionsByIds
        • _findCollectionsByIdsThenCalculate
      • Brands
        • _getBrandContent
        • _findBrandsByIds
      • Cart
        • _addToCartMulti
        • _addToCart
        • _setCart
        • _clearCart
        • _setCartListener
        • _removeFromCart
        • _calculateCart
      • Checkout
        • _startCheckout
        • _updateCheckout
        • _completeCheckout
      • Shopping Lists
        • _getShoppingLists
        • _updateShoppingList
        • _createShoppingList
        • _deleteShoppingList
        • _getShoppingListByAlias
      • Navigation
        • _getFooterMenu
        • _getHeaderMenu
      • Users
        • _getUserById
      • Utils
        • _calculateCurrency
        • _getCurrencySymbol
        • _getCulture
        • _subscribeToNewsletter
        • _findUnitsByIds
  • Noir
    • 0. Introduction
    • 1. Structure
      • Overview
      • LayoutA.liquid
      • ComponentsList.liquid
      • Metas.liquid
      • CssVariables.liquid
      • Json.liquid
      • GoogleTagManager.liquid
      • StagingButton.liquid
    • 2. Components
      • Overview
      • Announcement
      • BannerCarousel
      • BlogCategoryList
      • BlogList
      • BrandList
      • Breadcrumb
      • Cart
      • CategoriesList
      • ChangePassword
      • Checkout
      • CookieManager
      • FilterList
      • Footer
      • ForgotPassword
      • Form
      • IconBlock
      • Invitation
      • LastVisitedProducts
      • Login
      • Map
      • NavBar
      • ProductAttachments
      • ProductAttributes
      • ProductComparison
      • ProductDocumentation
      • ProductMixList
      • ProductsBlock
      • ProductsCarousel
      • ProductSingle
      • Profile
      • Register
      • RelatedProducts
      • SingleBlog
      • Stores
      • TextWithImage
      • ThankYouPage
      • TopBar
      • Wishlist
    • 3. Reusables
      • Overview
      • Addresses
      • BillingRetail
      • AddressForm
      • AnnouncementModal
      • BackToTop
      • Company
      • General
      • Login
      • LoginModal
      • Orders
      • Payment
      • ProductAttachments
      • ProductAttributes
      • ProductComparisonButton
      • ProductComparisonFloatingButton
      • ProductGridItem
      • ProductListItem
      • ShoppingListsButton
      • ProductModal
      • ProfileInfo
      • PromptModal
      • Register
      • Shipping
      • ShoppingLists
      • ShoppingListsNavbar
      • Toast
      • Users
      • VariantContent
      • WishlistButton
      • Services
    • 4. Assets
      • Fonts
      • Images
      • Templates
      • Javascript
        • Overview
        • theme.js
      • Css / Scss
        • Overview
        • ThemeClasses
    • 5. SDK
      • Overview
      • LiquidGlobals
      • ServicesSDK
  1. 3. Reusables

ShoppingListsNavbar

Purpose#

The ShoppingListsNavbar reusable provides the slide-in “Shopping Lists” panel that opens from the site navigation. It lists the user’s shopping lists and links into the Profile → Shopping Lists pages.
It relies on the global Alpine Shopping Lists store for:
visibility ($store.shoppingLists.visible)
list data ($store.shoppingLists.list)
open/close actions ($store.shoppingLists.close())

Where it's rendered#

This reusable is rendered from Components/NavBar/Default.liquid:
{% render 'Reusables\\ShoppingListsNavbar\\Default' %}

Inputs (Liquid render parameters)#

This reusable is rendered without Liquid parameters.

Model shape (storefront example)#

Sanitized real storefront example (provided by the user) of the shopping lists data used by the navbar.
This corresponds to the shape of $store.shoppingLists.list.
[
  {
    "id": "Shopping List Id",
    "title": "Sample text",
    "alias": "sample",
    "items": [
      {
        "productId": "Product Id",
        "productVariantId": "Product Variant Id",
        "quantity": 1,
        "product": {
          "id": "Product Id",
          "title": "Sample text",
          "alias": "sample"
        }
      },
      ...
    ]
  },
  ...
]
Notes:
In this theme, the Shopping Lists store often contains a final “pseudo list” entry that is excluded from UI rendering via .slice(0, -1).

Template behavior (Liquid + Alpine)#

Feature flag#

Rendered only when:
GlobalData.Settings.EnableShoppingLists is truthy.

Visibility + transitions#

The overlay container is shown when $store.shoppingLists.visible is true.
Clicking outside the slide-in panel closes it:
@click.outside="$store.shoppingLists.close()"
Height is bound as inline style:
:style="{ height }"

List rendering#

Renders a items for each shopping list in:
$store.shoppingLists.list.slice(0, -1)
Each entry links to:
/profile/shoppingLists/${shoppingList.alias}
Item count text uses singular/plural translations:
0 items → Items
1 item → Item
1 items → Items

Empty state#

When $store.shoppingLists.list.length == 1, it shows the “no lists found” message. This matches the convention that the store may contain only the pseudo-list entry.

Footer CTA#

The CTA links to /profile/shoppingLists.
If list length is 1 → shows “Create New List”.
If list length > 1 → shows “See all”.

JavaScript#

Global object#

Global object: shoppinglistsnavbarreusabledefault (in Reusables/ShoppingListsNavbar/Default.js).
It is used directly as an Alpine component object:
x-data="shoppinglistsnavbarreusabledefault"

State#

shoppingLists: local copy of Alpine.store('shoppingLists').list
height: computed overlay height (string, e.g. "600px")

Methods#

init()#

Waits for the Shopping Lists store to be ready via waitForShoppingListsReady().
Copies the list into this.shoppingLists.
Calls calculateHeight().
Recalculates height on resize and scroll.

waitForShoppingListsReady({ fetchIfEmpty, timeout })#

Polls until Alpine.store('shoppingLists') exists and has:
loading === false
list as an array
Behavior:
If fetchIfEmpty is true and the store is not loading and has fetch(), it triggers store.fetch() once when the list is empty.
Times out after timeout ms (default 8000) and returns the store (or null).

calculateHeight()#

Measures the header height and sets:
height = window.innerHeight - headerHeight
This ensures the overlay fills the viewport below the header.

Global Alpine stores#

This reusable uses:
$store.shoppingLists
visible
list
loading
fetch() (optional but used)
close()

Services / API calls#

This reusable does not call services directly.
It delegates fetching to $store.shoppingLists.fetch() when the store is empty.

Dependencies#

Liquid: Reusables/ShoppingListsNavbar/Default.liquid
JS: Reusables/ShoppingListsNavbar/Default.js
Translations: Reusables/ShoppingListsNavbar/Default.json
Render sites:
Components/NavBar/Default.liquid
Alpine stores:
$store.shoppingLists

Notes#

The overlay and panel both use x-show="$store.shoppingLists.visible". This is intentional to animate both the backdrop and the slide-in content.
The empty state check list.length == 1 assumes the Shopping Lists store always includes a final pseudo-list entry.
Modified at 2026-04-14 13:18:56
Previous
ShoppingLists
Next
Toast
Built with