commerce.apply_offer_or_discount
Applies OR updates a special offer and linked storefront banner on a specific product variant (targetVariant/targetVariants) or on the whole product and all its variants in place (preserves existing promotion dates and regular prices unless explicitly changed) or adds a discount coupon code.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"type": "<type>"
},
"name": "commerce.apply_offer_or_discount"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Promotion type: 'special_offer' updates live offerPrice & banner; 'coupon' adds checkout promo code; 'remove_offer' resets | |
| theme | No | Optional banner color theme | |
| siteId | No | Optional MongoDB Site ID | |
| endDate | No | Optional ISO expiry timestamp (omit to preserve existing) | |
| headline | No | Optional storefront banner headline | |
| badgeText | No | Optional pill badge text (e.g. '15% OFF') | |
| productId | No | Optional product ID | |
| startDate | No | Optional ISO start timestamp (omit to preserve existing) | |
| variantId | No | Optional exact variant ID to target (alias for targetVariant) | |
| couponCode | No | Coupon code (e.g. 'SAVE10') | |
| offerPrice | No | Special offer price in NPR (e.g. 1530) | |
| productName | No | Product name to search and update | |
| subheadline | No | Optional storefront banner subheadline | |
| variantName | No | Optional variant name/label to target (alias for targetVariant) | |
| durationDays | No | Optional duration in days | |
| durationHours | No | Optional duration in hours | |
| promotionName | No | Optional promotion/campaign name | |
| publishBanner | No | Set true to publish storefront banner, false for draft; omit to preserve | |
| targetVariant | No | Optional specific variant (e.g. '128GB', '8GB / 256GB', 'White / S', variant ID, or SKU) to discount or remove offer from. When provided, ONLY that variant is discounted and sibling variants keep their regular price. Omit to discount the whole product and all its variants. | |
| targetVariants | No | Optional list of multiple specific variants (e.g. ['128GB', '256GB']) to apply or remove the discount on. | |
| durationMinutes | No | Optional duration in minutes from now | |
| discountPercentage | No | Discount percentage (e.g. 15) |