Applies to: Catalog API
Learn how to create discounts that apply when customers buy a combination of items.
Important
Point of Sale applications must be version 5.15 or later to take advantage of pricing rules. For questions or feedback, contact Support.
- You need to create a Meal category of the
CatalogCategorytype in your catalog. To create a MealCatalogCategoryobject, follow this example. - You need to create a Drinks category of the
CatalogCategorytype in your catalog. To create a DrinksCatalogCategoryobject, follow this example.
To create a bundled discount, you need two catalog objects:
- A
DISCOUNTtype catalog object that applies a 10% discount to a meal and drink combo. - A
PRODUCT_SETtype catalog object that groups exactly one meal and one drink.
To configure a bundled discount, create a discount first.
The following request creates a 10% discount for drinks and meals:
The successful response returns a payload similar to the following:
{ "catalog_object": { "type": "DISCOUNT", "id": "GHJNSI4B2WQMC3SFMOZXTUH2", "updated_at": "2020-06-02T01:14:47.325Z", "version": 1591060487325, "is_deleted": false, "present_at_all_locations": true, "discount_data": { "discount_type": "FIXED_PERCENTAGE", "percentage": "10.0" } }, "id_mappings": [ { "client_object_id": "#10% Drink and Meal Discount", "object_id": "GHJNSI4B2WQMC3SFMOZXTUH2" } ] }
The temporary ID (of the #10% Drink and Meal Discount form) is optional unless the object is referenced elsewhere in the same request payload.
You might need to make note of the returned object_id for future references to this discount object.
In addition to creating a discount, you must set products targeted for the discount. To do this, create product set of the CatalogProductSet object.
The following request creates a product set consisting of a Drinks category (GXFTT46M3RCBR6LV54HKALC6 in the product_ids_all list) and a Meal category (GCCTVZOTCOPI246SREKXNMYX in the product_ids_all list):
The temporary ID (of the #Meals and Drinks form) is optional unless it's referenced elsewhere in the same request payload.
The successful response returns a payload similar to the following:
{ "catalog_object": { "type": "PRODUCT_SET", "id": "P47IPUGNDUIILQIYJMDKEDZO", "updated_at": "2020-06-02T01:02:08.712Z", "version": 1591059728712, "is_deleted": false, "present_at_all_locations": true, "product_set_data": { "product_ids_all": [ "GXFTT46M3RCBR6LV54HKALC6", "GCCTVZOTCOPI246SREKXNMYX" ], "quantity_exact": 1 } }, "id_mappings": [ { "client_object_id": "#Meals and Drinks", "object_id": "P47IPUGNDUIILQIYJMDKEDZO" } ] }
The pricing rule object determines when the discount is applied and to which items to apply it. Set the Meals and Drinks product set to match_product_id so the discount applies any time a Meal or Drinks category is in a cart.
The following request creates a pricing rule to enable automatic application of the 10% Drink and Meal Discount ("discount_id": "GHJNSI4B2WQMC3SFMOZXTUH2") to Meals and Drinks products and services ("match_products_id": "P47IPUGNDUIILQIYJMDKEDZO"):
You might need to call the SearchCatalogObjects endpoint to retrieve the desired discount and product set from the catalog to determined the IDs used as input to the request.
The successful response returns a payload similar to the following:
{ "catalog_object": { "type": "PRICING_RULE", "id": "VQACJLLOOEIDFZKWNNSZ6VLB", "updated_at": "2020-06-02T01:20:25.035Z", "version": 1591060825035, "is_deleted": false, "present_at_all_locations": true, "pricing_rule_data": { "name": "10% Off Meal and Drink", "discount_id": "GHJNSI4B2WQMC3SFMOZXTUH2", "match_products_id": "P47IPUGNDUIILQIYJMDKEDZO", "application_mode": "AUTOMATIC" } }, "id_mappings": [ { "client_object_id": "#10 Meal and Drink Discount Pricing Rule", "object_id": "VQACJLLOOEIDFZKWNNSZ6VLB" } ] }
You've now configured the pricing rule to enable the automatic application of the specified discount to the specified type of orders.