How to customize my products with metadata and SKUs?

In this section:

  1. Map your products
  2. Use schema validation
  3. 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. Let's learn how to do it.

Map your products

The first step is to create a schema which maps your products catalog's 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 

For example:

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
can have some attributes that are not built-in by default but you need them to customize 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  time  when the ride happens (redemption) and time when it was booked (custom metadata attribute).
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. You can see some videos with metadata use cases here.

Let's familiarize with Metadata Schema and learn how to create metadata attributes for products.


How to add product metadata with Schema

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

1. Open your Project Settings and the Metadata Schema section. Then, switch to 'PRODUCTS' Now, you can custom attributes, there is no limit on the number of added properties. Moreover, you can also define a type of each property (2) and add restrictions (optional values for a property; read on to find out more)

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

SAVE to confirm. From now on, all products you want to add (from the dashboard) or import to Voucherify have to match the schema. 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 4th stage of the campaign manager
  • choose the validation rule from 'Order structure' > 'Product metadata satisfy' and add 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. 

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, value of products from smartphones category needs to be more than $500)
  • 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).

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 Galaxy S8 64GB variant for example.

That's it! 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). 


(Hint for developers) 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) is just fine, an example of a payload:

{
   ...
   "order":{
      "amount":20050,
      "items":[
         {
            "product_id":"my_inventory_23f4nsdfdy2",
            "quantity":"2"
         },
         {
            "sku_id":"sku_0KtP4rvwEECQ2U",
            "quantity":"1"
         }
      ]
   }
   ...
}