Discounts
Discount codes customers type at checkout, and automatic discounts that apply by themselves when the cart qualifies.
Endpoints#
- GET
/discounts.jsonList discounts - GET
/discounts/count.jsonCount discounts - GET
/discounts/lookup.jsonLook up a code - GET
/discounts/{id}.jsonGet a discount - POST
/discounts.jsonCreate a discount - PUT
/discounts/{id}.jsonUpdate a discount - DELETE
/discounts/{id}.jsonDelete a discount
Paths are relative to https://store.weftgrid.com/api/admin/2026-10. The examples read the token from $STORELOOM_TOKEN and ids from variables like $ORDER_ID.
The discount object#
What the endpoints below return for one discount, and the payload of the discounts/create, discounts/update webhooks.
{
"id": "cm2disc0001",
"title": "WELCOME10",
"code": "WELCOME10",
"automatic": false,
"value_type": "percentage",
"value": "10",
"applies_to": "all",
"product_ids": [],
"collection_ids": [],
"minimum_subtotal": "30.00",
"minimum_quantity": 0,
"usage_limit": null,
"usage_count": 14,
"once_per_customer": true,
"starts_at": null,
"ends_at": null,
"active": true,
"volume": null,
"bundle": null,
"buy_x_get_y": null,
"created_at": "2026-09-20T10:00:00.000Z",
"updated_at": "2026-10-23T09:30:00.000Z"
}List discounts#
/discounts.jsonread_discounts| Parameter | Description |
|---|---|
limit, page_info, since_id, ids, fields | Pagination and selection. |
automatic | true for automatic discounts, false for codes. |
active | true or false (the on/off switch; dates and usage limits aren't taken into account). |
code | Exact code, in any case. |
created_at_min / created_at_max, updated_at_min / updated_at_max | ISO 8601 bounds. |
curl "https://store.weftgrid.com/api/admin/2026-10/discounts.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"Example responseShowHide
{
"discounts": [
{
"id": "cm2disc0001",
"title": "WELCOME10",
"code": "WELCOME10",
"automatic": false,
"value_type": "percentage",
"value": "10",
"applies_to": "all",
"product_ids": [],
"collection_ids": [],
"minimum_subtotal": "30.00",
"minimum_quantity": 0,
"usage_limit": null,
"usage_count": 14,
"once_per_customer": true,
"starts_at": null,
"ends_at": null,
"active": true,
"volume": null,
"bundle": null,
"buy_x_get_y": null,
"created_at": "2026-09-20T10:00:00.000Z",
"updated_at": "2026-10-23T09:30:00.000Z"
}
]
}Count discounts#
/discounts/count.jsonread_discounts| Parameter | Description |
|---|---|
automatic, active, code, ids, created_at_*, updated_at_* | Same filters as the list. |
curl "https://store.weftgrid.com/api/admin/2026-10/discounts/count.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"Example responseShowHide
{
"count": 5
}Look up a code#
/discounts/lookup.jsonread_discountsFinds the discount for a code as a customer would type it (any case, spaces ignored). 404 when there's none.
| Parameter | Description |
|---|---|
code | The code, e.g. welcome10. |
curl "https://store.weftgrid.com/api/admin/2026-10/discounts/lookup.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"Example responseShowHide
{
"discount": {
"id": "cm2disc0001",
"title": "WELCOME10",
"code": "WELCOME10",
"automatic": false,
"value_type": "percentage",
"value": "10",
"applies_to": "all",
"product_ids": [],
"collection_ids": [],
"minimum_subtotal": "30.00",
"minimum_quantity": 0,
"usage_limit": null,
"usage_count": 14,
"once_per_customer": true,
"starts_at": null,
"ends_at": null,
"active": true,
"volume": null,
"bundle": null,
"buy_x_get_y": null,
"created_at": "2026-09-20T10:00:00.000Z",
"updated_at": "2026-10-23T09:30:00.000Z"
}
}Get a discount#
/discounts/{id}.jsonread_discountscurl "https://store.weftgrid.com/api/admin/2026-10/discounts/$DISCOUNT_ID.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"Example responseShowHide
{
"discount": {
"id": "cm2disc0001",
"title": "WELCOME10",
"code": "WELCOME10",
"automatic": false,
"value_type": "percentage",
"value": "10",
"applies_to": "all",
"product_ids": [],
"collection_ids": [],
"minimum_subtotal": "30.00",
"minimum_quantity": 0,
"usage_limit": null,
"usage_count": 14,
"once_per_customer": true,
"starts_at": null,
"ends_at": null,
"active": true,
"volume": null,
"bundle": null,
"buy_x_get_y": null,
"created_at": "2026-09-20T10:00:00.000Z",
"updated_at": "2026-10-23T09:30:00.000Z"
}
}Create a discount#
/discounts.jsonwrite_discountsvalue_type is percentage (value is a whole percent, 1–100), fixed_amount (value is an amount like "5.00") or free_shipping (no value).
Volume, bundle and buy X get Y discounts have no value; their settings are an object. volume takes volume: { basis: "quantity" | "amount", reward: "percentage" | "fixed_amount", tiers: [{ minimum_quantity | minimum_amount, value }] } (up to 5 tiers, each needing more than the one before and giving more off; the highest tier reached applies). bundle_price takes bundle: { quantity, price, pick: "dearest" | "cheapest" }: any quantity eligible items for price, once per full set. buy_x_get_y takes buy_x_get_y: { buys: { quantity } | { amount }, gets: { quantity, percentage (100: free), applies_to: "same" | "products" | "collections", product_ids, collection_ids }, uses_per_order }; what customers buy is the discount's own applies_to. Sending the object replaces the old settings.
Code discounts need a code: up to 64 letters, numbers, hyphens or underscores, stored upper-case (customers can type any case). Automatic discounts (automatic: true) need a title, which buyers see in the cart.
applies_to is all, products (with product_ids) or collections (with collection_ids). Optional: minimum_subtotal (an amount) or minimum_quantity, usage_limit (total uses), once_per_customer, starts_at and ends_at (ISO 8601) and active.
Fires discounts/create.
{
"discount": {
"code": "HOME20",
"value_type": "percentage",
"value": "20",
"applies_to": "collections",
"collection_ids": [
"cm2coll0001"
],
"minimum_subtotal": "50.00",
"usage_limit": 200,
"ends_at": "2026-12-31T23:59:59Z"
}
}curl -X POST "https://store.weftgrid.com/api/admin/2026-10/discounts.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"discount": {
"code": "HOME20",
"value_type": "percentage",
"value": "20",
"applies_to": "collections",
"collection_ids": [
"cm2coll0001"
],
"minimum_subtotal": "50.00",
"usage_limit": 200,
"ends_at": "2026-12-31T23:59:59Z"
}
}'Example responseShowHide
{
"discount": {
"id": "cm2disc0001",
"title": "HOME20",
"code": "HOME20",
"automatic": false,
"value_type": "percentage",
"value": "20",
"applies_to": "collections",
"product_ids": [],
"collection_ids": [
"cm2coll0001"
],
"minimum_subtotal": "50.00",
"minimum_quantity": 0,
"usage_limit": 200,
"usage_count": 0,
"once_per_customer": false,
"starts_at": null,
"ends_at": "2026-12-31T23:59:59.000Z",
"active": true,
"volume": null,
"bundle": null,
"buy_x_get_y": null,
"created_at": "2026-09-20T10:00:00.000Z",
"updated_at": "2026-10-23T09:30:00.000Z"
}
}Update a discount#
/discounts/{id}.jsonwrite_discountsFields you leave out keep their values; send null to clear usage_limit, starts_at or ends_at. usage_count is read-only. Fires discounts/update.
value_type is percentage (value is a whole percent, 1–100), fixed_amount (value is an amount like "5.00") or free_shipping (no value).
Volume, bundle and buy X get Y discounts have no value; their settings are an object. volume takes volume: { basis: "quantity" | "amount", reward: "percentage" | "fixed_amount", tiers: [{ minimum_quantity | minimum_amount, value }] } (up to 5 tiers, each needing more than the one before and giving more off; the highest tier reached applies). bundle_price takes bundle: { quantity, price, pick: "dearest" | "cheapest" }: any quantity eligible items for price, once per full set. buy_x_get_y takes buy_x_get_y: { buys: { quantity } | { amount }, gets: { quantity, percentage (100: free), applies_to: "same" | "products" | "collections", product_ids, collection_ids }, uses_per_order }; what customers buy is the discount's own applies_to. Sending the object replaces the old settings.
Code discounts need a code: up to 64 letters, numbers, hyphens or underscores, stored upper-case (customers can type any case). Automatic discounts (automatic: true) need a title, which buyers see in the cart.
applies_to is all, products (with product_ids) or collections (with collection_ids). Optional: minimum_subtotal (an amount) or minimum_quantity, usage_limit (total uses), once_per_customer, starts_at and ends_at (ISO 8601) and active.
{
"discount": {
"active": false
}
}curl -X PUT "https://store.weftgrid.com/api/admin/2026-10/discounts/$DISCOUNT_ID.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"discount": {
"active": false
}
}'Example responseShowHide
{
"discount": {
"id": "cm2disc0001",
"title": "WELCOME10",
"code": "WELCOME10",
"automatic": false,
"value_type": "percentage",
"value": "10",
"applies_to": "all",
"product_ids": [],
"collection_ids": [],
"minimum_subtotal": "30.00",
"minimum_quantity": 0,
"usage_limit": null,
"usage_count": 14,
"once_per_customer": true,
"starts_at": null,
"ends_at": null,
"active": false,
"volume": null,
"bundle": null,
"buy_x_get_y": null,
"created_at": "2026-09-20T10:00:00.000Z",
"updated_at": "2026-10-23T09:30:00.000Z"
}
}Delete a discount#
/discounts/{id}.jsonwrite_discountsOrders that used it keep the code and amount. Fires discounts/delete.
curl -X DELETE "https://store.weftgrid.com/api/admin/2026-10/discounts/$DISCOUNT_ID.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"Example responseShowHide
{}