Skip to main content

Cross-Selling Product Relationships

Cross-selling is a powerful merchandising strategy where businesses suggest alternative or complementary products to customers during their shopping journey. This approach not only enhances the customer experience by offering relevant options but also boosts revenue by encouraging customers to explore and purchase additional products.

For example, a customer viewing a laptop might be shown accessories like a wireless mouse, laptop sleeve, or external storage drive. This creates a seamless shopping experience, helping customers discover items they might need but didn’t actively search for.

This guide provides step-by-step instructions to set up cross-sell relationships in Product Experience Manager API and Commerce Manager, manage them efficiently, and display them in the catalog for frontend integration. By following this process, you can create dynamic, data-driven cross-sell sections on your storefront, like a “You Might Also Like” or “Frequently Bought Together” feature.

Prerequisites

Before you start, ensure that the following requirements are met:

  • An access token.
  • Products created which you want to cross-sell together. 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": "You might also like",
"slug": "CRP_you_might_also_like",
"bi_directional": true
}
}
}'

The bi_directional flag indicates if this is a one way or bi-directional relationship. When cross-selling products setting bi_directional to true will allow Product A to be linked to Product B, which intrinsically links Product B to Product A.

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

Use the following request to link products. Replace :product_id_a in the URL with the ID of Product A and {{product_id_b}} in the body with the ID of Product B:

    curl -X POST https://useast.api.elasticpath.com/pcm/products/:product_id_a/custom-relationships/CRP_you_might_also_like \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": [
{
"type": "product",
"id": "{{product_id_b}}"
}
]
}'

If you want to associate multiple products at once, you can include additional product IDs in the data array of a single request. This approach allows you to link a product to several related products efficiently. Here's an example:

   curl -X POST https://useast.api.elasticpath.com/pcm/products/:product_id_a/custom-relationships/CRP_you_might_also_like \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": [
{
"type": "product",
"id": "{{product_id_b}}"
},
{
"type": "product",
"id": "{{product_id_c}}"
},
{
"type": "product",
"id": "{{product_id_d}}"
}
]
}'

By adding multiple product IDs to the data array, you can associate several products with a single API call, saving time and streamlining your workflow. This method is particularly useful when establishing relationships for a group of related or complementary products.

See Associate a Product to other Products API Reference.

3. Publish the Catalog

Publish the catalog using the following request. 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

To enhance the shopping experience, you can display related products on the Product Detail Page (PDP). For example, a "You Might Also Like" section can showcase products linked through the cross-sell relationship. The following API endpoints return a paginated list of related products with their full details, making it easy to build this feature.

  1. Retrieve the list of products linked to Product A by replacing :product_id_a with Product A's ID. This will return products associated with the CRP_you_might_also_like relationship slug.
        curl -X GET https://useast.api.elasticpath.com/catalog/products/:product_id_a/relationships/CRP_you_might_also_like/products \
    -H "Authorization: Bearer XXXX" \
    -H "Content-Type: application/json"
  2. Since this is a bi-directional relationship, Product B is automatically linked to Product A. To confirm, retrieve related products for Product B by replacing :product_id_b with Product B's ID:
        curl -X GET https://useast.api.elasticpath.com/catalog/products/:product_id_b/relationships/CRP_you_might_also_like/products \
    -H "Authorization: Bearer XXXX" \
    -H "Content-Type: application/json"

Procedure - Commerce Manager

1. Create a custom relationship

  1. Navigate to the Products > Custom Relationships tab.
  2. Click "Create Custom Relationship" button.
  3. Entering a relationship name will automatically generate the slug.
  4. Checking the "Relationship is bi-directional" checkbox indicates this is a bi-directional relationship. When cross-selling products checking this box will allow Product A to be linked to Product B, which intrinsically links Product B to Product A.

2. Associating products

  1. 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.
  2. On the "Product Details" page, open the "Product Relationships" section and click on the "Add a Product Relationship" button.
  3. On the "Add a Product Relationship", press "Select" on the custom relationship created in "1. Create a custom relationship" and close.
  4. Back on the "Product Details" page, in the "Product Relationships" section, you can create product to product associations.
  5. Press "Select Products" which will open a list of products. Press the "+" button to relate the products to this product.
  6. Close the list of products and press "Save & Exit".
  7. You can navigate to the products you associated with this product. They will automatically have this Custom Relationship added and will show the other product in the "Products in this Relationship" list.

3. Publish the Catalog

For more details, see Publish a catalog

Demo

See Commerce Manager Demo.