Skip to Content
Support Hub
Integrations & ActionsIntegrate add-to-cart with HCL Commerce

Integrations & Actions

Integrate add-to-cart with HCL Commerce

This guide shows how to integrate Mavenoid with HCL Commerce to enable Add-to-Cart functionality using the Storefront REST API.

Requirements

  • Contributor Access To Mavenoid: If you do not have contributor permissions, please reach out to your Mavenoid representative.

  • Mavenoid Embed Script Access: The integration uses the External Script node in Mavenoid.

Configure the Integration

The setup is managed through the External Script in Mavenoid and the Storefront REST API. Note that no additional token-based authentication is required since the page frontend handles this.

  1. Retrieve Product SKU
    Obtain the product SKU from your data management system, or directly add SKUs as form data in Mavenoid if you build the product selection journey there.

  2. Check Product Availability:
    Use an API call to verify product availability. Based on the product’s status, you can customize user flow - allowing them to add items to the cart if in stock or offering alternative actions if out of stock.

  3. Authenticate the user:

    • Check Session:
      Verify if the user has an active session: GET /wcs/resources/store/{store_id}/usercontext/@self/contextdata

    • Create Guest User:
      If no session exists, initiate a guest session: POST /wcs/resources/store/11251/guestidentity?updateCookies=true
       

    Consult IBM Digital Commerce Services - Authentication and Session Management for details.

  4. Add product to cart:
    Pass the SKU to the external script and trigger the Add-to-Cart API call:

POST /wcs/resources/store/11251/cart/
{
  orderItem: [
    {
      partNumber: {SKU},
      quantity: {quantity}
    }
  ]
}

Important: Include the header credentials: include in all API calls to HCL Commerce to ensure session cookies are included, supporting user authentication across requests.

For more details, see the guides on IBM Digital Commerce Services - Cart
and External Script Configuration.

Need more help?

Ask a different questionIntegrations & Actions
Select a different product
© 2024 Mavenoid ABSitemap
Terms of servicePrivacy policyCookie policyData processing agreement