Store Hugs Developers

Offers

Automatic discounts: buy X get Y, quantity discounts and amount discounts, applied without a code.

Reach them through $admin->offers. Reading needs the marketing:read scope, changing them marketing:write.

List offers

$admin->offers->list(array $query = []): array

One page of the shop's offers, newest first, or oldest change first with updatedSince. Read the next page with meta.nextCursor as cursor. Scope: marketing:read.

Parameters

Parameter Type
$query array The query fields below, by name.

Query fields

ParameterTypeDescription
limitintegerAt least 1. At most 100. Default 50.
cursorstringmeta.nextCursor (or the cursor in links.next) of the previous page. At most 1000 characters.
updatedSincestring (date-time)Records changed at or after this time (ISO 8601, any offset or Z), oldest change first, for incremental sync.

Returns

An array with data (a list of AdminOffer), links and meta:

FieldTypeDescription
linksobject
links.firstnull
links.lastnull
links.prevstring (uri) or null
links.nextstring (uri) or null
metaobject
meta.pathstring (uri)
meta.perPageinteger
meta.nextCursorstring or null
meta.prevCursorstring or null
dataarray of AdminOffer
data[].idinteger
data[].namestring
data[].typestringOne of buy_x_get_y, quantity_discount, amount_discount.
data[].configOfferConfigbuy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers.
data[].config.buyobject
data[].config.buy.qtyintegerAt least 1. At most 1000.
data[].config.buy.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
data[].config.buy.scope.taxonomyFiltersobject (map) or null
data[].config.buy.scope.taxonomyLabelsobject (map) or null
data[].config.buy.scope.productIdsarray of integer or nullAt most 200 items.
data[].config.buy.scope.productLabelsobject (map) or null
data[].config.buy.scope.excludeProductIdsarray of integer or nullAt most 200 items.
data[].config.buy.scope.excludeProductLabelsobject (map) or null
data[].config.rewardobject
data[].config.reward.kindstringOne of items, discount.
data[].config.reward.qtyinteger or nullRequired for items. At least 1. At most 1000.
data[].config.reward.getScopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
data[].config.reward.getScope.taxonomyFiltersobject (map) or null
data[].config.reward.getScope.taxonomyLabelsobject (map) or null
data[].config.reward.getScope.productIdsarray of integer or nullAt most 200 items.
data[].config.reward.getScope.productLabelsobject (map) or null
data[].config.reward.getScope.excludeProductIdsarray of integer or nullAt most 200 items.
data[].config.reward.getScope.excludeProductLabelsobject (map) or null
data[].config.reward.valueTypestringOne of percentage, fixed.
data[].config.reward.valuenumberAt most 100 for a percentage.
data[].config.reward.appliesTostring or nullRequired for discount. One of buy_items, order.
data[].config.maxApplicationsinteger or nullAt least 1.
data[].config.tiersarray of objectminQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items.
data[].config.tiers[].minQtyintegerAt least 1.
data[].config.tiers[].minSubtotalnumberAt least 0.
data[].config.tiers[].valueTypestringOne of percentage, fixed.
data[].config.tiers[].valuenumber
data[].config.maxDiscountAmountnumber or nullamount_discount only. At least 0.
data[].config.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
data[].config.scope.taxonomyFiltersobject (map) or null
data[].config.scope.taxonomyLabelsobject (map) or null
data[].config.scope.productIdsarray of integer or nullAt most 200 items.
data[].config.scope.productLabelsobject (map) or null
data[].config.scope.excludeProductIdsarray of integer or nullAt most 200 items.
data[].config.scope.excludeProductLabelsobject (map) or null
data[].statusboolean
data[].combinableWithCouponsboolean
data[].priorityinteger or null
data[].usageLimitinteger or null
data[].usedCountinteger or null
data[].startsAtstring (date-time) or null
data[].endsAtstring (date-time) or null
data[].createdAtstring (date-time) or null
data[].updatedAtstring (date-time) or null

Errors

StatusWhen
401invalid_api_key: no active Admin key in Authorization: Bearer.
403admin_key_in_browser (an Origin header was sent), ip_not_allowed, plan_required(the shop's plan lacks the Integration API, or the feature the endpoint needs), orinsufficient_scope.
422Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid).
429Rate limited.

Example

$page = $admin->offers->list(['limit' => 50]);
$cursor = $page['meta']['nextCursor'];

Iterate over every offer

$admin->offers->all(array $query = []): Generator

Every offer matching the query, one at a time, fetching the next page as you read. It takes the same query as list, without cursor. Scope: marketing:read.

Returns

A generator of AdminOffer arrays, each:

FieldTypeDescription
[].idinteger
[].namestring
[].typestringOne of buy_x_get_y, quantity_discount, amount_discount.
[].configOfferConfigbuy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers.
[].config.buyobject
[].config.buy.qtyintegerAt least 1. At most 1000.
[].config.buy.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
[].config.buy.scope.taxonomyFiltersobject (map) or null
[].config.buy.scope.taxonomyLabelsobject (map) or null
[].config.buy.scope.productIdsarray of integer or nullAt most 200 items.
[].config.buy.scope.productLabelsobject (map) or null
[].config.buy.scope.excludeProductIdsarray of integer or nullAt most 200 items.
[].config.buy.scope.excludeProductLabelsobject (map) or null
[].config.rewardobject
[].config.reward.kindstringOne of items, discount.
[].config.reward.qtyinteger or nullRequired for items. At least 1. At most 1000.
[].config.reward.getScopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
[].config.reward.getScope.taxonomyFiltersobject (map) or null
[].config.reward.getScope.taxonomyLabelsobject (map) or null
[].config.reward.getScope.productIdsarray of integer or nullAt most 200 items.
[].config.reward.getScope.productLabelsobject (map) or null
[].config.reward.getScope.excludeProductIdsarray of integer or nullAt most 200 items.
[].config.reward.getScope.excludeProductLabelsobject (map) or null
[].config.reward.valueTypestringOne of percentage, fixed.
[].config.reward.valuenumberAt most 100 for a percentage.
[].config.reward.appliesTostring or nullRequired for discount. One of buy_items, order.
[].config.maxApplicationsinteger or nullAt least 1.
[].config.tiersarray of objectminQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items.
[].config.tiers[].minQtyintegerAt least 1.
[].config.tiers[].minSubtotalnumberAt least 0.
[].config.tiers[].valueTypestringOne of percentage, fixed.
[].config.tiers[].valuenumber
[].config.maxDiscountAmountnumber or nullamount_discount only. At least 0.
[].config.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
[].config.scope.taxonomyFiltersobject (map) or null
[].config.scope.taxonomyLabelsobject (map) or null
[].config.scope.productIdsarray of integer or nullAt most 200 items.
[].config.scope.productLabelsobject (map) or null
[].config.scope.excludeProductIdsarray of integer or nullAt most 200 items.
[].config.scope.excludeProductLabelsobject (map) or null
[].statusboolean
[].combinableWithCouponsboolean
[].priorityinteger or null
[].usageLimitinteger or null
[].usedCountinteger or null
[].startsAtstring (date-time) or null
[].endsAtstring (date-time) or null
[].createdAtstring (date-time) or null
[].updatedAtstring (date-time) or null

Example

foreach ($admin->offers->all(['updatedSince' => $lastSyncedAt]) as $offer) {
    $erp->saveOffer($offer);
}

Get an offer

$admin->offers->get(int $id): array

One offer by its id. Scope: marketing:read.

Parameters

Parameter Type
$id int The offer's id.

Returns

An AdminOffer:

FieldTypeDescription
idinteger
namestring
typestringOne of buy_x_get_y, quantity_discount, amount_discount.
configOfferConfigbuy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers.
config.buyobject
config.buy.qtyintegerAt least 1. At most 1000.
config.buy.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.buy.scope.taxonomyFiltersobject (map) or null
config.buy.scope.taxonomyLabelsobject (map) or null
config.buy.scope.productIdsarray of integer or nullAt most 200 items.
config.buy.scope.productLabelsobject (map) or null
config.buy.scope.excludeProductIdsarray of integer or nullAt most 200 items.
config.buy.scope.excludeProductLabelsobject (map) or null
config.rewardobject
config.reward.kindstringOne of items, discount.
config.reward.qtyinteger or nullRequired for items. At least 1. At most 1000.
config.reward.getScopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.reward.getScope.taxonomyFiltersobject (map) or null
config.reward.getScope.taxonomyLabelsobject (map) or null
config.reward.getScope.productIdsarray of integer or nullAt most 200 items.
config.reward.getScope.productLabelsobject (map) or null
config.reward.getScope.excludeProductIdsarray of integer or nullAt most 200 items.
config.reward.getScope.excludeProductLabelsobject (map) or null
config.reward.valueTypestringOne of percentage, fixed.
config.reward.valuenumberAt most 100 for a percentage.
config.reward.appliesTostring or nullRequired for discount. One of buy_items, order.
config.maxApplicationsinteger or nullAt least 1.
config.tiersarray of objectminQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items.
config.tiers[].minQtyintegerAt least 1.
config.tiers[].minSubtotalnumberAt least 0.
config.tiers[].valueTypestringOne of percentage, fixed.
config.tiers[].valuenumber
config.maxDiscountAmountnumber or nullamount_discount only. At least 0.
config.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.scope.taxonomyFiltersobject (map) or null
config.scope.taxonomyLabelsobject (map) or null
config.scope.productIdsarray of integer or nullAt most 200 items.
config.scope.productLabelsobject (map) or null
config.scope.excludeProductIdsarray of integer or nullAt most 200 items.
config.scope.excludeProductLabelsobject (map) or null
statusboolean
combinableWithCouponsboolean
priorityinteger or null
usageLimitinteger or null
usedCountinteger or null
startsAtstring (date-time) or null
endsAtstring (date-time) or null
createdAtstring (date-time) or null
updatedAtstring (date-time) or null

Errors

StatusWhen
401invalid_api_key: no active Admin key in Authorization: Bearer.
403admin_key_in_browser (an Origin header was sent), ip_not_allowed, plan_required(the shop's plan lacks the Integration API, or the feature the endpoint needs), orinsufficient_scope.
404not_found: the shop has no such record.
429Rate limited.

Create an offer

$admin->offers->create(array $input, string|false|null $idempotencyKey = null): array

A new offer. name, type and config are required. type is buy_x_get_y, which takes buy and reward in its config, or quantity_discount or amount_discount, which take tiers. Scope: marketing:write.

Parameters

Parameter Type
$input array The offer's fields, below.
$idempotencyKey string|false|null Your own Idempotency-Key, or false for none. One is made for you when null.

Request fields

FieldTypeDescription
name requiredstringAt most 255 characters.
type requiredstringOne of buy_x_get_y, quantity_discount, amount_discount.
config requiredOfferConfigbuy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers.
config.buy requiredobject
config.buy.qty requiredintegerAt least 1. At most 1000.
config.buy.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.buy.scope.taxonomyFiltersobject (map) or null
config.buy.scope.taxonomyLabelsobject (map) or null
config.buy.scope.productIdsarray of integer or nullAt most 200 items.
config.buy.scope.productLabelsobject (map) or null
config.buy.scope.excludeProductIdsarray of integer or nullAt most 200 items.
config.buy.scope.excludeProductLabelsobject (map) or null
config.reward requiredobject
config.reward.kind requiredstringOne of items, discount.
config.reward.qtyinteger or nullRequired for items. At least 1. At most 1000.
config.reward.getScopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.reward.getScope.taxonomyFiltersobject (map) or null
config.reward.getScope.taxonomyLabelsobject (map) or null
config.reward.getScope.productIdsarray of integer or nullAt most 200 items.
config.reward.getScope.productLabelsobject (map) or null
config.reward.getScope.excludeProductIdsarray of integer or nullAt most 200 items.
config.reward.getScope.excludeProductLabelsobject (map) or null
config.reward.valueType requiredstringOne of percentage, fixed.
config.reward.value requirednumberAt most 100 for a percentage.
config.reward.appliesTostring or nullRequired for discount. One of buy_items, order.
config.maxApplicationsinteger or nullAt least 1.
config.tiers requiredarray of objectminQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items.
config.tiers[].minQtyintegerAt least 1.
config.tiers[].minSubtotalnumberAt least 0.
config.tiers[].valueType requiredstringOne of percentage, fixed.
config.tiers[].value requirednumber
config.maxDiscountAmountnumber or nullamount_discount only. At least 0.
config.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.scope.taxonomyFiltersobject (map) or null
config.scope.taxonomyLabelsobject (map) or null
config.scope.productIdsarray of integer or nullAt most 200 items.
config.scope.productLabelsobject (map) or null
config.scope.excludeProductIdsarray of integer or nullAt most 200 items.
config.scope.excludeProductLabelsobject (map) or null
combinableWithCouponsboolean or null
priorityinteger or nullAt least 0. At most 1000.
usageLimitinteger or nullAt least 1.
startsAtstring (date-time) or null
endsAtstring (date-time) or null
statusboolean or null

Returns

The new AdminOffer:

FieldTypeDescription
idinteger
namestring
typestringOne of buy_x_get_y, quantity_discount, amount_discount.
configOfferConfigbuy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers.
config.buyobject
config.buy.qtyintegerAt least 1. At most 1000.
config.buy.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.buy.scope.taxonomyFiltersobject (map) or null
config.buy.scope.taxonomyLabelsobject (map) or null
config.buy.scope.productIdsarray of integer or nullAt most 200 items.
config.buy.scope.productLabelsobject (map) or null
config.buy.scope.excludeProductIdsarray of integer or nullAt most 200 items.
config.buy.scope.excludeProductLabelsobject (map) or null
config.rewardobject
config.reward.kindstringOne of items, discount.
config.reward.qtyinteger or nullRequired for items. At least 1. At most 1000.
config.reward.getScopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.reward.getScope.taxonomyFiltersobject (map) or null
config.reward.getScope.taxonomyLabelsobject (map) or null
config.reward.getScope.productIdsarray of integer or nullAt most 200 items.
config.reward.getScope.productLabelsobject (map) or null
config.reward.getScope.excludeProductIdsarray of integer or nullAt most 200 items.
config.reward.getScope.excludeProductLabelsobject (map) or null
config.reward.valueTypestringOne of percentage, fixed.
config.reward.valuenumberAt most 100 for a percentage.
config.reward.appliesTostring or nullRequired for discount. One of buy_items, order.
config.maxApplicationsinteger or nullAt least 1.
config.tiersarray of objectminQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items.
config.tiers[].minQtyintegerAt least 1.
config.tiers[].minSubtotalnumberAt least 0.
config.tiers[].valueTypestringOne of percentage, fixed.
config.tiers[].valuenumber
config.maxDiscountAmountnumber or nullamount_discount only. At least 0.
config.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.scope.taxonomyFiltersobject (map) or null
config.scope.taxonomyLabelsobject (map) or null
config.scope.productIdsarray of integer or nullAt most 200 items.
config.scope.productLabelsobject (map) or null
config.scope.excludeProductIdsarray of integer or nullAt most 200 items.
config.scope.excludeProductLabelsobject (map) or null
statusboolean
combinableWithCouponsboolean
priorityinteger or null
usageLimitinteger or null
usedCountinteger or null
startsAtstring (date-time) or null
endsAtstring (date-time) or null
createdAtstring (date-time) or null
updatedAtstring (date-time) or null

Errors

StatusWhen
401invalid_api_key: no active Admin key in Authorization: Bearer.
403admin_key_in_browser (an Origin header was sent), ip_not_allowed, plan_required(the shop's plan lacks the Integration API, or the feature the endpoint needs), orinsufficient_scope.
409idempotency_in_progress: a request with this Idempotency-Key is still running. Retry with the same key after Retry-After seconds; the first answer is then replayed.
422Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid).
429Rate limited.

Example

$offer = $admin->offers->create([
    'name' => 'Buy more, save more',
    'type' => 'quantity_discount',
    'config' => [
        'tiers' => [
            ['minQty' => 3, 'valueType' => 'percentage', 'value' => 10],
            ['minQty' => 5, 'valueType' => 'percentage', 'value' => 15],
        ],
    ],
    'endsAt' => '2026-12-31T23:59:59Z',
]);

Update an offer

$admin->offers->update(
    int $id,
    array $changes,
    DateTimeInterface|string|null $unmodifiedSince = null,
    string|false|null $idempotencyKey = null,
): array

Changes only the fields sent. A config sent replaces the whole config, and setting status to false pauses the offer. Scope: marketing:write.

Parameters

Parameter Type
$id int The offer's id.
$changes array The fields to change, below.
$unmodifiedSince DateTimeInterface|string|null The offer's updatedAt as you read it. If it changed since, the change is refused with 409 edit_conflict.
$idempotencyKey string|false|null Your own Idempotency-Key, or false for none.

Request fields

FieldTypeDescription
namestringAt most 255 characters.
typestringOne of buy_x_get_y, quantity_discount, amount_discount.
configOfferConfigbuy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers.
config.buy requiredobject
config.buy.qty requiredintegerAt least 1. At most 1000.
config.buy.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.buy.scope.taxonomyFiltersobject (map) or null
config.buy.scope.taxonomyLabelsobject (map) or null
config.buy.scope.productIdsarray of integer or nullAt most 200 items.
config.buy.scope.productLabelsobject (map) or null
config.buy.scope.excludeProductIdsarray of integer or nullAt most 200 items.
config.buy.scope.excludeProductLabelsobject (map) or null
config.reward requiredobject
config.reward.kind requiredstringOne of items, discount.
config.reward.qtyinteger or nullRequired for items. At least 1. At most 1000.
config.reward.getScopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.reward.getScope.taxonomyFiltersobject (map) or null
config.reward.getScope.taxonomyLabelsobject (map) or null
config.reward.getScope.productIdsarray of integer or nullAt most 200 items.
config.reward.getScope.productLabelsobject (map) or null
config.reward.getScope.excludeProductIdsarray of integer or nullAt most 200 items.
config.reward.getScope.excludeProductLabelsobject (map) or null
config.reward.valueType requiredstringOne of percentage, fixed.
config.reward.value requirednumberAt most 100 for a percentage.
config.reward.appliesTostring or nullRequired for discount. One of buy_items, order.
config.maxApplicationsinteger or nullAt least 1.
config.tiers requiredarray of objectminQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items.
config.tiers[].minQtyintegerAt least 1.
config.tiers[].minSubtotalnumberAt least 0.
config.tiers[].valueType requiredstringOne of percentage, fixed.
config.tiers[].value requirednumber
config.maxDiscountAmountnumber or nullamount_discount only. At least 0.
config.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.scope.taxonomyFiltersobject (map) or null
config.scope.taxonomyLabelsobject (map) or null
config.scope.productIdsarray of integer or nullAt most 200 items.
config.scope.productLabelsobject (map) or null
config.scope.excludeProductIdsarray of integer or nullAt most 200 items.
config.scope.excludeProductLabelsobject (map) or null
combinableWithCouponsboolean or null
priorityinteger or nullAt least 0. At most 1000.
usageLimitinteger or nullAt least 1.
startsAtstring (date-time) or null
endsAtstring (date-time) or null
statusboolean or null
updatedAtstring (date-time) or nullThe record's updatedAt as you read it; a newer record gets 409 edit_conflict.

Returns

The changed AdminOffer:

FieldTypeDescription
idinteger
namestring
typestringOne of buy_x_get_y, quantity_discount, amount_discount.
configOfferConfigbuy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers.
config.buyobject
config.buy.qtyintegerAt least 1. At most 1000.
config.buy.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.buy.scope.taxonomyFiltersobject (map) or null
config.buy.scope.taxonomyLabelsobject (map) or null
config.buy.scope.productIdsarray of integer or nullAt most 200 items.
config.buy.scope.productLabelsobject (map) or null
config.buy.scope.excludeProductIdsarray of integer or nullAt most 200 items.
config.buy.scope.excludeProductLabelsobject (map) or null
config.rewardobject
config.reward.kindstringOne of items, discount.
config.reward.qtyinteger or nullRequired for items. At least 1. At most 1000.
config.reward.getScopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.reward.getScope.taxonomyFiltersobject (map) or null
config.reward.getScope.taxonomyLabelsobject (map) or null
config.reward.getScope.productIdsarray of integer or nullAt most 200 items.
config.reward.getScope.productLabelsobject (map) or null
config.reward.getScope.excludeProductIdsarray of integer or nullAt most 200 items.
config.reward.getScope.excludeProductLabelsobject (map) or null
config.reward.valueTypestringOne of percentage, fixed.
config.reward.valuenumberAt most 100 for a percentage.
config.reward.appliesTostring or nullRequired for discount. One of buy_items, order.
config.maxApplicationsinteger or nullAt least 1.
config.tiersarray of objectminQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items.
config.tiers[].minQtyintegerAt least 1.
config.tiers[].minSubtotalnumberAt least 0.
config.tiers[].valueTypestringOne of percentage, fixed.
config.tiers[].valuenumber
config.maxDiscountAmountnumber or nullamount_discount only. At least 0.
config.scopeOfferScope or nullNarrows the products the offer counts; null is the whole catalog.
config.scope.taxonomyFiltersobject (map) or null
config.scope.taxonomyLabelsobject (map) or null
config.scope.productIdsarray of integer or nullAt most 200 items.
config.scope.productLabelsobject (map) or null
config.scope.excludeProductIdsarray of integer or nullAt most 200 items.
config.scope.excludeProductLabelsobject (map) or null
statusboolean
combinableWithCouponsboolean
priorityinteger or null
usageLimitinteger or null
usedCountinteger or null
startsAtstring (date-time) or null
endsAtstring (date-time) or null
createdAtstring (date-time) or null
updatedAtstring (date-time) or null

Errors

StatusWhen
401invalid_api_key: no active Admin key in Authorization: Bearer.
403admin_key_in_browser (an Origin header was sent), ip_not_allowed, plan_required(the shop's plan lacks the Integration API, or the feature the endpoint needs), orinsufficient_scope.
404not_found: the shop has no such record.
409edit_conflict (the record changed after If-Unmodified-Since or updatedAt), or idempotency_in_progress.
422Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid).
429Rate limited.

Example

$offer = $admin->offers->get(3);
$admin->offers->update(3, ['status' => false], unmodifiedSince: $offer['updatedAt']);

Delete an offer

$admin->offers->delete(int $id): void

Deletes an offer. Scope: marketing:write.

Parameters

Parameter Type
$id int The offer's id.

Returns

Nothing.

Errors

StatusWhen
401invalid_api_key: no active Admin key in Authorization: Bearer.
403admin_key_in_browser (an Origin header was sent), ip_not_allowed, plan_required(the shop's plan lacks the Integration API, or the feature the endpoint needs), orinsufficient_scope.
404not_found: the shop has no such record.
409idempotency_in_progress: a request with this Idempotency-Key is still running. Retry with the same key after Retry-After seconds; the first answer is then replayed.
422Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid).
429Rate limited.