How to customize my products with metadata and SKUs?

In this section:


Map your products.


Use schema validation.


Set validation rules.

In this tutorial, we'll show you how to use product metadata to offer customized, product-specific coupon deals.

The Product Manager helps you create coupon campaigns active only if a shopper's cart includes one of the selected products (e.g., iPhone X) or its variant (iPhone X 32GB), see the tutorial. But what if you want to create a discount for a product family, brand, category, or any other element they have in common? This can be achieved with product metadata. 

Map your products

The first step is to create a schema that maps your product catalog structure. The schema enforces data integrity of your products, take a look at this example.

Imagine your products follow such a structure: 

Category > Manufacturer > Series > Products > SKU 

Category: Smartphones

Manufacturer: Samsung

Line: Galaxy S

Product: Galaxy S8

SKU: Galaxy S8 64GB

Create metadata attributes

What is metadata?

Metadata enables you to add custom data to Voucherify, which you can later use for building validation rules and reporting/ tracking.  

Every object type like:

  • vouchers
  • campaigns
  • customers
  • products
  • SKUs
  • redemptions
  • publications
  • orders

can have some attributes that are not built-in by default but you need them to customize your promo campaigns. For example, you can add custom attributes to your customers, and segment them accordingly to attributes unique for your business model. Moreover, metadata added to redemption object enables you to create limits for redemptions which are not possible with built-in validation rules. 

For example, taxi companies very often offer promo codes for rides booked at particular hours, redemption metadata enables them to create redemption rules based on the  time when the ride happens (redemption) and time when it was booked (custom metadata attribute). 

Here is a video tutorial about creating custom redemption time based on metadata attributes:

Note that now you may create nested metadata properties if your business logic does not match with the pre-defined metadata objects.

There are plenty of use cases for metadata and each of them is unique. They give you extreme flexibility and freedom in creating rules and limits for promotions and segmentation of your customers.

How to add product metadata with Schema?

With the Metadata Schema Validation, you can reflect custom product properties. In effect, every product will get a set of custom fields (each one for a corresponding level or in an array form) which you can fill in if you decide to add/import your product catalog to Voucherify. The product and SKU are built-in objects in Voucherify, so according to our use case from the first paragraph you need to create custom fields f or the  category, manufacturer, and line. Here's how to do it:

Open your Project Settings and the Metadata Schema section. Then, switch to the Product object.

Metadata Object

Now, you can add custom attributes, there is no limit on the number of added properties. Moreover, you can also define a type of each property and add restrictions (optional values for a property). Types of properties are:

  • string (text)
  • number
  • flag
  • date
  • date time
  • image URL

New metadata category

Note that you can additionally define custom restrictions for the fields.

Product Metadata

Click Save to confirm. From now on, all products you want to add (from the Dashboard) or import to Voucherify have to match the schema (unless you do not check the mandatory box). Otherwise, an error will be shown.

The schema is configured per project.

Read a step-by-step guide on Metadata-Schema Validation

Create validation rules with product metadata

To build validation rules with Metadata-Schema Validation, you need to:

  • open Validation Rules section or start creating a new campaign and add rules in the 3rd stage of the Campaign Manager,
  • choose the validation rule from 'Order structure' > 'Product metadata satisfy' and add the required value for a chosen metadata property.

Note that you don't have to import your inventory to create validation rules based on product metadata. Voucherify enables you to add products with metadata while creating the API redemption request.

Order Structure

You can create additional restrictions for items with the chosen attribute;

  • Quantity of matched items – how many products with added metadata property need to be in the customer's cart (for example two items from smartphones category).
  • Subtotal of matched items – the required value of items with added metadata in the customer's cart (for example, the value of products from the smartphones category needs to be more than $500).
  • All order items must match – all items in the customer's cart need to meet the metadata criteria. 
  • Discount applicable to related products – set if the discount applies to items with added metadata property (for example, all products with metadata 'category' and its value 'smartphones' are discounted when a code is redeemed).

Product Metadata Satisfy

Assigned limits will be listed below the category automatically after choosing the rule (in a grey box), you can remove them anytime with the cross. Note that you can mix multiple validation rules to get the desired promotion outcome; you can limit this discount by excluding the Galaxy S8 64GB variant for example.

From now on, when a customer tries to redeem the coupon, Voucherify will automatically check if their cart matches your product criteria (along with other validation rules you've defined). 

Also, visit our Voucherify Cookbook to learn how to launch a promo campaign based on SKUs.

You can also watch our video tutorial on working with Products and SKUs in Voucherify:

When it comes to the Voucherify API integration, there's no need to introduce any changes to your code. A standard redemption request with items identified by  product_id(either Voucherify generated or your internal id) is just fine.

Here is an example of a payload:


Still need help? Contact Us Contact Us