Skip to main content
Skip table of contents

Override capabilities for Add to Cart button on the Product Details LWC

Add to Cart Override Capabilities

Associations and their members have an improved experience when working with the Lighting Store on Community Hub. Association staff and admin users can now define and set the destination behavior of the ‘Add to Cart' button for Products through staff view. The feature provides opportunities for Associations to offer product types other than Merchandise through the Lightning Store and control the next steps in the purchase process.

Instructions to configure the feature

Step1: Create a new field to provide the destination URL for Product Detail LWC’s Add to Cart button

  • Setup >

  • Object Manager >

  • Search Product (custom object) >

  • Click Product > Fields & Relationships>

  • New>

    • Data Type: Formular>Next>

    • Field Label: *type desired label*AddToCartOverride>

    • Field Name: auto populates>

    • Formula Return Type: Text> *add logic that returns the full URL that should be invoked when the 'Add to Cart' button is clicked on the Product Details page for a particular product in Community Hub. When adding the formula consider the path for other products as well and that the URL returned is appropriate for all the products. If the URL returned is blank, the default behavior for Add to Cart is invoked.*

  • Check Syntax to ensure there's no error> Next> *check the applicable visible box next to the Field-Level Security for profile* > Next>

  • Save

  • Note the API Name of the field. This will be needed for step 2.


Step 2: Complete Custom Metadata for ProductDetailsAddToCartOverride

  • Setup >

  • Custom Metadata Types >

  • Click Manage Records near General Settings >

  • Click Edit near ProductDetailsAddtoCartOveride label

  • Leave the defaults in the following fields:

    • Label: ProductDetailsAddtoCartOveride

    • General Setting Name: ProductDetailsAddtoCartOveride

    • Is Active check

    • Key: Field Name

    • Value: *copy & paste the API name for field created in Step 1: * (Ex. AddtoCartOverride__c)

  • Save

Step 3: Test your configuration

  • Log into Community Hub

  • Go to Lightning Store

  • Browse and click on a Product card to go to Product Details

  • Click on Add to Cart

  • Confirm that Add to Cart invokes the logic defined within the field created in Step 1.

  • Repeat the process for other products, as needed, to ensure that the Add to Cart behaves correctly for them as well.





JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.