Offering discounts for bundles
Some merchants may want to offer bundle-specific or quantity-based discounts on bundles. By default, dynamically priced bundles will use the subscription or one-time price associated with the bundle selection product. However, you can accomplish custom discounting - bundle discounts or quantity-based discounts - by using the bundle selections API and overriding the price of each bundle selection.
Before creating discounts, the Bundles team must enable the feature. To enable this feature, reach out to [email protected].
Note:
Creating discounts for Bundles requires custom coding and use of the Recharge API. Custom coding is not supported by the Recharge support team as per our design and integration policy. You can work with a developer, contact a Recharge Partner, or if eligible, take advantage of Recharge's Merchant Development Program to implement these changes.
Create discounts
To create discounts for bundles, you must retrieve a JSON object with information about the bundle, items, and prices. Then you must override each item's price in the bundle with the discounted prices. Refer to the following steps and code snippets to create discount for bundles:
- Make a
GET
request to/bundle_selections
with thepurchase_items_ids
parameter set to the subscription ID. In the following example, theGET
request is retrieving thepurchase_items_ids
of 346359203:
curl 'https://api.rechargeapps.com/bundle_selections?purchase_item_ids=346359203' \
-H 'X-Recharge-Version: 2021-11' \
-H "X-Recharge-Access-Token: $TOKEN"
- Use the returned JSON object to view the information about the bundle, items, and prices.
- Make a
PUT
request to/bundle_selections/:id
with the updated item prices. In the following example, thePUT
request sets the price for each select to $1.00 per item, resulting in a total bundle cost of $12:
curl -X PUT 'https://api.rechargeapps.com/bundle_selections/324474' \
-H 'X-Recharge-Version: 2021-11' \
-H 'Content-Type: application/json' \
-H "X-Recharge-Access-Token: $TOKEN" \
-d '{
"items": [
{
"id": 4176688,
"collection_id": "437254881586",
"collection_source": "shopify",
"created_at": "2023-03-27T21:38:04+00:00",
"external_product_id": "8152797053234",
"external_variant_id": "44580980588850",
"price": "1.00",
"quantity": 6,
"updated_at": "2023-03-27T21:38:04+00:00"
},
{
"id": 4176687,
"collection_id": "437254881586",
"collection_source": "shopify",
"created_at": "2023-03-27T21:38:04+00:00",
"external_product_id": "8152798560562",
"external_variant_id": "44580987142450",
"price": "1.00",
"quantity": 6,
"updated_at": "2023-03-27T21:38:04+00:00"
}
]
}'
Note:
The
bundle_selections/:id
endpoint requires theID
of the bundle selection to be updated. You can retrieve theID
by making aGET
request to the/bundle_selections
endpoint with thepurchase_item_ids
parameter set to the subscription ID, as shown in the previous example.
Updated about 2 months ago