create_code_discount_bxgy
Create a Buy X Get Y discount code that gives customers a percentage off or free items when they purchase specified products or collections.
Instructions
Create a Buy X Get Y (BXGY) code discount. Customers enter a code to get a discount when they buy specified items.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Internal name shown in admin. | |
| code | Yes | Code customers enter at checkout. | |
| startsAt | Yes | Activation date (ISO 8601). | |
| endsAt | No | ||
| appliesOncePerCustomer | No | ||
| usesPerOrderLimit | No | Max times this discount applies per order. | |
| buyQuantity | Yes | Number of items customer must buy (e.g. '3'). | |
| buyAll | No | Buy items from all products. Default: true if no buyProductIds/buyCollectionIds. | |
| buyProductIds | No | GIDs of products customer must buy. | |
| buyCollectionIds | No | GIDs of collections customer must buy from. | |
| getQuantity | Yes | Number of items customer gets at a discount (e.g. '1'). | |
| getAll | No | Get discount on any product. Default: true if no getProductIds/getCollectionIds. | |
| getProductIds | No | GIDs of products customer gets. | |
| getCollectionIds | No | GIDs of collections customer gets from. | |
| getDiscountType | Yes | Type of discount applied to the 'get' items. | |
| getDiscountPercentage | No | Percentage off (0–100, e.g. 20 for 20%). Required when getDiscountType is 'percentage'. | |
| combinesWith | No | Discount classes this discount can combine with. |