Related-product coupons

Add metadata to the Product object.
Upload products into Voucherify via API or manually.
Create a customer segment for customers who purchased a product from Swimwear Category.
Add product-based and segment-based validation rules to the campaign.

related product diagram

If you don't want to upload particular products to Voucherify, you can build your campaigns with the use of metadata for some product categories which will be passed and checked during the validation and redemption of a promo code.

Add metadata

Begin by adding a Category metadata property to the Product object. By using metadata, you can add custom information about a product and pass it in the API calls during validation and redemption requests. For instance, only products with Sunglassesmetadata property are eligible for the discount. 

To add metadata, visit the Metadata Schema in your Project Settings. Add a Category property to the Product object. Make it a string with a value equal to either Swimwear or Sunglasses. Keep in mind that you can make this property optional or mandatory for all products.

Category Metadata

Upload products

Next, add products to Voucherify. You can do it in two ways – via Dashboard (manually) or API (programmatically). The use of API is recommended with high-volume imports.

Go to the Products tab to add a new product. Begin by naming the product, set its price and source ID. If you want to create different variants of the same products (SKUs), add product attributes that you will use to differentiate between different product versions.

Product Details

Select metadata property for this product.

Product metadata

Add another product from the Sunglasses category based on the previous step.

Before segmenting your customer base, it is recommended to upload your customer data into Voucherify via API, CSV import, or manually. Note that you can also operate on the customer ID in the API calls without uploading customer data into Voucherify.

Create a customer segment

Move on to segment your audience based on order history. Purchased_bikini is not a pre-built Voucherfiy filter, but you can create it with the use of custom events. With the use of this filter, you can additionally specify when the custom event should take place in order for the customer to be placed in this customer segment. 

customer segment

Move on to the final step of this guide – creating a coupon campaign. The coupons are going to be available under two conditions:

  • The redeeming user belongs to the Purchase Bikini segment.
  • The discount will be applicable only if the user has sunglasses in the cart and it will be applied only to this product, not the whole order. 

Add validation rules to the coupon campaign

Open the Campaign Manager. Provide general details of the campaign such as name, timeframe, code pattern, code redemption limits, and more.

Next, establish the discount and product- and segment-based validation rules.

Segment validation rule


Note that instead of basing this campaign on a particular product, you could also use the product metadata satisfy property. Then, any product from the Sunglasses category will be counted towards the discount.

Product metadata satisfy

Save the campaign and wait for the codes to be generated. Now, move on to publish codes to customers via API, Distribution mechanism, or 3rd party providers.

Follow this guide for more information on how to deliver codes to customers.