List suggested promotions
const url = 'https://apibase.ecomweb.app/api/v1/storefront/stores/example/promotions/suggestions';const options = {method: 'GET', headers: {'x-storefront-api-key': '<x-storefront-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://apibase.ecomweb.app/api/v1/storefront/stores/example/promotions/suggestions \ --header 'x-storefront-api-key: <x-storefront-api-key>'Returns up to 10 active discount-code promotions that have started and not ended and that the merchant enabled for checkout suggestions, so a checkout can offer them to the shopper.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The store’s ref, as returned by GET /stores.
Responses
Section titled “Responses”object
Up to 10 active discount-code promotions that have started and not ended and that the merchant enabled for checkout suggestions.
object
The discount code, stored upper-case.
Description, or null.
What the promotion does: PRODUCT_DISCOUNT, CART_DISCOUNT, FREE_SHIPPING, FIXED_PRICE or GIFT.
PERCENTAGE or FIXED_AMOUNT. Null for promotions without a discount value.
The discount: a percentage or an amount, depending on discount_method. Null when not set.
Cap on the discount for a percentage promotion. Null when there is none.
Minimum order amount the promotion needs. Null when there is none.
Minimum number of items the promotion needs. Null when there is none.
When the promotion ends, as an ISO 8601 timestamp. Null when it has no end date.
Promotion ID.
Promotion name.
When the promotion starts, as an ISO 8601 timestamp.
Always true.
Example
{ "promotions": [ { "type": "PRODUCT_DISCOUNT", "discount_method": "PERCENTAGE" } ]}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route or on a Storefront route that needs a secret key, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}