Skip to content

Delete All Compare Items ​

Remove every product from the authenticated customer's comparison list in a single request.

Endpoint ​

POST /api/shop/delete-all-compare-items

Request Headers ​

HeaderRequiredDescription
Content-TypeYesapplication/json
X-STOREFRONT-KEYYesYour storefront API key
AuthorizationYesCustomer Bearer token (Bearer <accessToken>)

Request Body ​

No fields are required. Send an empty JSON object:

json
{}

Response Fields (201 Created) ​

FieldTypeDescription
messagestringAll compare items have been removed successfully.
deletedCountintegerHow many rows were removed. 0 when the list was already empty.

Behaviour ​

  • Clears only the authenticated customer's rows. The comparison list is not channel-scoped, so one call empties it everywhere.
  • Repeating the call is safe; the second one answers 201 with deletedCount: 0.
  • The message reads the same whether rows were removed or not — read deletedCount to know what happened.

Use Cases ​

  • "Clear comparison" button — one call empties the table, and deletedCount tells the UI how many columns to drop without a re-fetch.
  • Reset between comparison sessions — clearing is cheaper than deleting each row when the shopper starts a new set.

Best Practices ​

  • Confirm in the UI first — the call takes no ID and is irreversible.
  • Read deletedCount, not message — the message is identical on an empty list.

Released under the MIT License.