@nosto/search-js
    Preparing search index...

    Function addToCart

    • Adds a search hit to the cart.

      Parameters

      • type: SearchTrackOptions

        The type of search that the hit belongs to.

      • hit: SearchHitWithSku

        The search hit to add to the cart.

      • quantity: number = 1

        The quantity of the hit to add to the cart.

      Returns Promise<void>

      import { addToCart } from '@nosto/search-js'

      // Add a single product to cart
      await addToCart('serp', {
      productId: '123',
      skuId: 'sku-123'
      })

      // Add multiple quantities
      await addToCart('serp', {
      productId: '456',
      skuId: 'sku-456'
      }, 3)