Upselling Product Relationships
Upselling is a useful technique to offer customers add-ons or enhancements to their purchase, providing them with a personalized shopping experience while increasing the average order value (AOV). In a coffee shop, for instance, upselling could involve offering customers options like adding flavors (e.g., vanilla or caramel), toppings (e.g., whipped cream or cinnamon), or extras (e.g., an additional espresso shot).
This guide demonstrates how to set up upselling product relationships in Product Experience Manager API and Commerce Manager, enabling businesses to suggest such add-ons seamlessly in their catalog and on the frontend.
Prerequisites
Before you start, ensure that the following requirements are met:
- An access token.
- A base product and products to upsell. You will need at least 2 products for this example.
- A Catalog has been created with at least 1 existing release.
Procedure - API
1. Create a custom relationship
Use the following request to define a custom relationship:
curl -X POST https://useast.api.elasticpath.com/pcm/custom-relationships \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"type": "custom-relationship",
"attributes": {
"name": "Coffee Add-Ons",
"slug": "CRP_coffee_addons",
"bi_directional": false
}
}
}'
The bi_directional
flag is set to false
because upselling is typically a one-way relationship, where Product A suggests an upgrade to Product B but not the reverse.
This request creates the custom relationship and returns an ID. Make sure to note the ID for future use. For additional details, refer to the Create Custom Relationships section.
See Create a Custom Relationship API Reference.
2. Associating products
Link the base product (e.g., a latte) to one or more upsell options (e.g., caramel, whipped cream, cinnamon). Replace :product_id_base
with the base product’s ID and {{product_id_addon}}
with the add-on product’s ID:
curl -X POST https://useast.api.elasticpath.com/pcm/products/:product_id_base/custom-relationships/CRP_coffee_addons \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": [
{
"type": "product",
"id": "{{product_id_addon}}"
}
]
}'
If you would like to associate more than one product at once, you can add more ids to the data array.
To associate multiple add-on products in a single request, simply include additional product IDs in the data array. For example:
curl -X POST https://useast.api.elasticpath.com/pcm/products/:product_id_base/custom-relationships/CRP_coffee_addons \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": [
{
"type": "product",
"id": "{{product_id_addon_1}}"
},
{
"type": "product",
"id": "{{product_id_addon_2}}"
},
{
"type": "product",
"id": "{{product_id_addon_3}}"
}
]
}'
This allows you to link the base product to several upsell options in one step, saving time and simplifying the process.
See Associate a Product to other Products API Reference.
3. Publish the Catalog
Publish the catalog to activate the upsell relationships. Replace :catalog_id
in the URL with the Catalog ID:
curl -X POST https://useast.api.elasticpath.com/catalogs/:catalog_id/releases \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"export_full_delta": true,
"include_organization_resources": true
}
}'
For more details, see Publish a catalog
4. Integrate and Display Upsell Options on the Frontend
To showcase upselling options dynamically on your Product Detail Page (PDP), use the following approach. Fetch the related products from the API and design a frontend section such as “Customize Your Drink” or “Enhance Your Order.”
Use this API endpoint to fetch add-ons for the base product (e.g., coffee). Replace
:product_id_base
with the ID of the base product:curl -X GET https://useast.api.elasticpath.com/catalog/products/:product_id_base/relationships/CRP_coffee_addons/products \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json"This will return a paginated list of related products with full details.
Upselling is a one-way relationship, so add-ons will not suggest the base product. To verify this, replace
:product_id_addon
with the add-on product’s ID:curl -X GET https://useast.api.elasticpath.com/catalog/products/:product_id_addon/relationships/CRP_coffee_addons/products \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json"This request should return an empty list, confirming the one-way nature of the relationship.
Procedure - Commerce Manager
1. Create a custom relationship
- Navigate to the Products > Custom Relationships tab.
- Click "Create Custom Relationship" button.
- Entering a relationship name will automatically generate the slug.
- Keeping the "Relationship is bi-directional" checkbox un-checked indicates this is a one-way relationship. Upselling is typically a one-way relationship, where Product A suggests an upgrade to Product B but not the reverse.
2. Associating products
- Navigate to the Products > All Products tab and click on a product you want to add to this custom relationship to bring up the Product Details edit page.
- On the "Product Details" page, open the "Product Relationships" section and click on the "Add a Product Relationship" button.
- On the "Add a Product Relationship", press "Select" on the custom relationship created in "1. Create a custom relationship" and close.
- Back on the "Product Details" page, in the "Product Relationships" section, you can create product to product associations.
- Press "Select Products" which will open a list of products. Press the "+" button to relate the products to this product.
- Close the list of products and press "Save & Exit".
- You can navigate to the products you associated with this product. They will not have this Custom Relationship added or a relationship to the other product..
3. Publish the Catalog
For more details, see Publish a catalog