Skip to content

Remove Coupon

Remove a discount coupon code from the shopping cart.

Endpoint

POST /api/shop/remove-coupon

Request Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
X-STOREFRONT-KEYYesYour storefront API key
AuthorizationYesThe cart's own token as a Bearer token, or a logged-in customer's token.

Request Body

Send {}. The cart is identified by the token, and the coupon by whatever is currently on that cart — there is no code to name.

Response

201 Created carrying the whole recalculated cart, the same object Get Cart returns, with couponCode back to null.

FieldTypeDescription
successbooleantrue when the call completed.
messagestringCoupon removed successfully.
couponCodestringnull after removal.
discountAmount / grandTotalnumberRecalculated without the discount.

The call is idempotent — running it on a cart with no coupon still answers 201 with success: true, so it is safe to call before applying a new code.

Effects

  • The discount is dropped and the totals are recalculated, including any shipping or tax that depended on the discounted subtotal.
  • Cart items are untouched.
  • A cart holds one coupon at a time, so applying a different code replaces the current one without needing this call first.

Use Cases

  • "Remove" next to an applied coupon — one call, then re-render from the returned cart.
  • Reset before trying another code — optional, since Apply Coupon overwrites the existing one.

Best Practices

  • Re-render from the response — it is the full recalculated cart, so no follow-up fetch is needed.
  • Do not guard the call behind "is a coupon applied" — it is safe on a coupon-less cart.
  • Send the cart token — without a Bearer token the call fails with 401, even though the body is empty.
  • Apply Coupon — apply a discount code to the cart
  • Get Cart — read the current items and recalculated totals

Released under the MIT License.