This document focuses on the Complements API within the recommendation module. This API identifies and showcases products that serve as complements or accessories to the primary product being viewed. By analyzing product categories, tags, and attributes, it recommends items that enhance the usage, functionality, or experience of the primary product. This feature helps drive additional sales by suggesting relevant add-ons that customers might need or want alongside their initial purchase.

Imagine a customer browsing for a new smartphone on an electronics eCommerce platform. While the primary focus might be on the phone's specifications, the Complements API can enhance the shopping experience by recommending complementary products such as protective cases, screen protectors, wireless charging stations, and earphones that are compatible with that specific smartphone model. These recommendations help ensure the customer considers all necessary accessories that could enhance their product experience, potentially leading to a more satisfying purchase and increased sales for the platform.

Compare to other Personalization API features:

  • Bought Together
    While the Bought Together recommends items based on historical co-purchase data, indicating what other customers have bought together, the Complements focuses on the compatibility and relevance of complementary products to the primary item, regardless of past purchasing patterns.

  • Similar
    The Similar offers alternatives or substitutes that closely match the product in view, focusing on similarity in features or specifications. In contrast, the Complements focuses on products that enhance or are used in conjunction with the primary product.

  • Random
    Random introduces a variety of products without a specific focus, the Complements specifically targets items that add value to or are necessary for the primary product being considered.

The following is a sample request using the AfterShip Personalization API, requesting recommendations of type COMPLEMENTS. The request includes the following parameters:

  • type: Specifies the recommendation type, set to COMPLEMENTS in this case.

  • session_id: Represents the unique identifier for the user session.

  • limit: Determines the maximum number of products to be returned in the response. In this case, the limit is set to 5.

  • products: Contains an array of products for which complementary recommendations are requested. Each product includes an id, source_id, and variants (along with their corresponding source_id).Typical use cases include passing the main product id in the product page, or passing cart line items in the cart page/checkout page.

Sample Request

preparing...

By providing these parameters, the API will analyze the compatibility and relevance of products and generate a curated list of frequently co-purchased products that complement the specified product. This helps users discover complementary products and encourages additional purchases.

Sample Response

preparing...