Home
Wiki
Home
Wiki
  1. 2. Components
  • 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. 2. Components

Wishlist

Purpose#

The Wishlist component renders the wishlist page.
It:
renders only when the feature flag GlobalData.Settings.EnableWishlist is enabled
renders the wishlist product grid (using Reusables\\ProductGridItem\\Default)
supports clearing the wishlist via a confirmation modal
hides removed items immediately when it receives wishlistUpdated events
warns the user when wishlist changes in another tab (localStorage sync)
supports sorting and pagination via query-string navigation

Inputs (model contract)#

Model shape (storefront example)#

{
  "products": [
    {
      "id": "Product Id",
      "title": "Sample product title",
      "link": "product/sample-product",
      "mediaItems": [
        {
          "id": "Media Item Id",
          "link": "https://example.com/media/sample.jpg",
          "position": 0,
          "alt": "sample.jpg",
          "mediaType": "Image"
        },
        "..."
      ],
      "productVariants": [
        {
          "id": "Variant Id",
          "finalPriceText": "Sample price text",
          "finalPrice": 10
        },
        "..."
      ],
      "dimension1": {
        "attributeId": "Attribute Id",
        "type": "Color"
      },
      "dimension2": {
        "attributeId": "Attribute Id",
        "type": "Size"
      },
      "startPriceText": "Sample price text",
      "hasPriceRange": true,
      "inWishlist": true
    },
    "..."
  ],
  "name": "Wishlist",
  "view": "Default",
  "section": "SectionA",
  "settings": {
    "id": "Component Id",
    "section": "SectionA",
    "type": "NoirWishlist",
    "name": "Wishlist",
    "configuredInContentApi": true,
    "view": "Default",
    "displayName": "",
    "cssClass": ""
  },
  "translations": {
    "wishlist": "Sample text",
    "modalTitleText": "Sample text",
    "modalMessageText": "Sample text",
    "...": "..."
  }
}

Required fields#

settings.id

Optional fields#

settings.cssClass
products[]
When empty/missing, the component renders an empty state.
pagination (used only by the template):
pagination.totalCount
pagination.pageNumber
pagination.numberOfPages
translations.*

JavaScript#

Global object#

Components/Wishlist/Default.js exposes:
Liquid binds it via Alpine:
<section x-data='wishlistdefault.initComponent({{ productsCount }}, {{ products | serialize | escape }})'>

initComponent(productsCount, products)#

What it does
Creates and returns the Alpine state object.

init()#

What it does
Initializes list and clears removedIds.
Registers listeners:
wishlistUpdated (same-tab updates)
storage for wishlistSync (cross-tab changes)
Key behaviors / edge cases
Any storage event for wishlistSync triggers showReloadWarning = true.

handleWishlistUpdated(event)#

What it does
When a product is removed from the global wishlist store, adds it to removedIds.
Sets hideList = true when all products are removed.

redirectToState(newPage = null)#

What it does
Builds a query string with:
page
sort
Navigates by setting window.location.href.

clearList(clearListErrorMessage)#

What it does
Calls servicesreusabledefault.clearWishlist().
On success, hides the list.
On failure, shows a toast.

handleClearModal(modalTranslations)#

What it does
Opens the modal store and wires buttons:
Clear → calls clearList(...)
Cancel → closes modal

Global Alpine stores (used by Wishlist)#

$store.wishlist (live wishlist ids)#

Used in handleWishlistUpdated(...) to check whether an item is still in the wishlist:
Alpine.store("wishlist").items.includes(detail.id)

$store.modal (confirmation dialog)#

Used to show the “clear wishlist” confirmation dialog.

$store.toast (user feedback)#

Used to show errors from API operations.

Services / API calls#

servicesreusabledefault.clearWishlist()
Clears the wishlist server-side.

Dependencies#

Alpine.js
Reusables\\ProductGridItem\\Default
Theme utilities:
servicesreusabledefault.clearWishlist()
Alpine stores:
wishlist
modal
toast

Notes#

The template supports a sliding-window pagination UI (Liquid-only).
Cross-tab sync is implemented via localStorage key wishlistSync.

Extras#

Template behavior (Liquid + Alpine)#

Builds a modalTranslations JSON string in Liquid and passes it into handleClearModal(...).
Filters out removed products at render time via removedIds.includes(product.id).
If hideList becomes true, it shows the empty-state UI even if the original server products[] was non-empty.
Modified at 2026-04-14 13:18:56
Previous
TopBar
Next
Overview
Built with