hermosodocs

Shopify discount codes

A "use code SUMMER20" ad needs a real code at checkout. Hermoso creates it on your Shopify store, lists the codes you have and turns one off, and every answer is Shopify's own copy of the code, read back after the change. It works for a store that installed Hermoso from the Shopify App Store, and it costs no credits.

Create a code

create_shopify_discount_code makes a code for every customer and every product.

FieldWhat it is
codeRequired. What customers type at checkout, with no spaces.
percentOff or amountOffOne of the two. 20 is 20% off; an amount is in the store's currency. appliesOnEachItem: true takes a fixed amount off each item instead of the whole order.
minSubtotal or minQuantityOptional, one of the two: a minimum order amount or a minimum number of items.
startsAt, endsAtWhen the code works. It starts now unless you say otherwise, and has no end date unless you give one.
usageLimit, oncePerCustomerHow many times it can be used in total, and whether each customer can use it once.

A code works at the live checkout and every use is money off your sales, so the first call creates nothing: it describes the code. Call again with confirm: true to create it. Nothing you wrote is changed: a code with a space, 0% or more than 100%, or an end date in the past is refused with the reason.

List and turn off

The routes are POST /api/shopify/discount, GET /api/shopify/discounts and POST /api/shopify/discount/disable.

The permission

Discount codes need one more Shopify permission. A store that installed Hermoso before it was added is asked to approve it the next time the app is opened from the Shopify admin. Until then, these tools answer with that step, and nothing is created or changed.