Commerce

Create a discount

Creates a code discount (buyers enter a code) or an automatic one (applied at checkout), as a percentage, a fixed amount or free shipping. It applies to every product unless productIds or collectionIds narrow it, and to every buyer.

post/v1/commerce/discounts

Request body

accountIdstring required
titlestring required
method'code' | 'automatic' required
type'percentage' | 'fixed_amount' | 'free_shipping' required
codestring

Required for method code.

percentagenumber

For type percentage, e.g. 15 for 15%.

amountstring

For type fixed_amount, a decimal in the store currency.

appliesOnEachItemboolean

fixed_amount only: take the amount off each item instead of once per order.

minimumSubtotalstring nullable

Minimum order subtotal, a decimal in the store currency.

minimumQuantityinteger nullable
usageLimitinteger nullable

Code discounts only: total uses allowed.

oncePerCustomerboolean

Code discounts only.

startsAtstring date-time

Defaults to now.

endsAtstring date-time nullable
productIdsstring[]
collectionIdsstring[]

Response

Discount created

Example response

{
  "discount": {
    "value": {
      "percentage": 15
    },
    "minimum": {
      "amount": {
        "amount": "19.90",
        "currency": "USD"
      }
    }
  }
}

Changes

Changed in 2 of the 60 revisions of this API.2