Skip to main content

Add to cart

Theme developers can use a JavaScript window function to support "add to cart" operations. The function requires the plan IDs of the product and add-on editions. It automatically manages the cart preview and user redirection.

Prerequisites

📝 Note: If the AppDirect logo appears in the upper-left corner of the page, when Manage > Marketplace appears in this topic, click the grid icon > Switch to | Store, instead.

The AppDirect checkout flow supports either Buy Now or Add to Cart buttons. The information in this section is only relevant if your marketplace uses the Add to Cart button.

To enable the Add to Cart button

  1. Go to Manage > Marketplace > Settings > Billing Settings | Billing Functionality.
  2. In the Product Configurator section, select Add to Cart.
  3. At the bottom of the page, click Save Settings.

Usage

Add the following function to your JavaScript code:

window.AD_addToCart(EditionPlanId, [AddonsPlanId, AddonsPlanId])

You can retrieve the pricing plan ID with the Data viewer. On a product page, navigate to the following data:

application > editions > items > 0 > plans > 0 > uuid

When activated, the callToActions list can include an Add To Cart action. You must catch the ADD_TO_CART actionType and trigger the AD_addToCart function on click.

Was this page helpful?