commercetools icon

commercetools

Interact with the commercetools API. Operations are auto-generated from the official Postman collection.

Actions671

Shipping-method → Check if matching ShippingMethod exists for a Cart

AI-generated

Summary

Check if there is a matching ShippingMethod for a specified Cart by performing a HEAD request to the commercetools API using the Cart Id.

Inputs

  • Cart Id (required) — The ID of the Cart to check for an existing matching ShippingMethod.

Output shape

A JSON object containing 'exists' (boolean), 'statusCode' (HTTP status), and 'url' (request URL) indicating whether a matching ShippingMethod exists for the Cart.

The operation uses an HTTP HEAD request and returns existence based on the status code: 200 means exists, 404 means does not exist. Errors with other status codes are thrown as NodeApiError.

Examples

Example 1: Cart with matching ShippingMethod

Input Cart Id: '12345'. Result JSON: {exists: true, statusCode: 200, url: 'https://api..commercetools.com//shipping-methods/matching-cart-12345'}

Example 2: Cart without matching ShippingMethod

Input Cart Id: 'abcde'. Result JSON: {exists: false, statusCode: 404, url: 'https://api..commercetools.com//shipping-methods/matching-cart-abcde'}

Links

Discussion