Template Docs Commerce APIs Webhooks Tools
Get Started
Get Started

Delete a product variant

DELETE https://api.squarespace.com/{api-version}/commerce/products/{productId}/variants/{variantId}

Deletes a variant of a physical product. Requests that try to delete a product with one variant will fail since a product must always have at least one variant.

Note: This endpoint does not delete any image assigned to the variant since images always belong to the product.

A successful request deletes a ProductVariant that belongs to the parent Product. Read the Overview to learn more about these resources.

Parameters

If needed, see the "Related endpoints" section to learn how to retrieve resource ids.

{api-version} string
required

See the Products API Overview page for the current API version.


{productId} string
required

Specifies the parent Product of the ProductVariant.


{variantId} string
required

Specifies the ProductVariant to delete.

Request example

Read the Making requests guide to learn why specific headers are necessary, and why some are omitted. Every request should also abide by Squarespace rate limits.

curl "https://api.squarespace.com/{api-version}/commerce/products/123/variants/456" \
 -i \
 -H "Authorization: Bearer YOUR_API_KEY_OR_OAUTH_TOKEN" \
 -H "User-Agent: YOUR_CUSTOM_APP_DESCRIPTION" \
 -X DELETE

Response example

A response to a successful request will not contain any data.

Status codes and error conditions

204 NO CONTENT

The ProductVariant was deleted successfully.


404 NOT FOUND

Type: INVALID_REQUEST_ERROR

Subtype: INVALID_ARGUMENT
Either the Product or the ProductVariant was not found.


405 METHOD NOT ALLOWED

Type: METHOD_NOT_ALLOWED

Subtype: OPERATION_NOT_ALLOWED_FOR_PRODUCT_TYPE
The Product requested is not a physical Product.

Related endpoints

To retrieve ids for Products and their ProductVariants, use these suggested endpoints: