update-fulfillment-preference
Method: POST
Path: /carts/{id}/fulfillment-preference
Tags: Carts
Summary
Update fulfillment preference
Description
Update fulfillment preference
Storefront SDK Usage
SDK Method: sdk.cart.updateFulfillmentPreference()
Example:
typescript
const { data, error } = await sdk.cart.updateFulfillmentPreference(
{ id: "01H9CART12345ABCDE" },
{
fulfillment_type: "delivery",
shipping_provider_id: "01H9SHIP12345FAST",
courier_company_id: "01H9COY12345FAST", // Optional
}
);
if (error) {
console.error("Failed to update fulfillment preference:", error.message);
} else {
console.log("Fulfillment preference updated:", data.cart.fulfillment_preference?.fulfillment_type);
console.log("Shipping cost:", data.cart.shipping_amount);
}TypeScript Definition
typescript
"update-fulfillment-preference": {
parameters: {
query?: never;
header?: never;
path: {
/** @description Cart ID */
id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["FulfillmentPreference"];
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
cart?: components["schemas"]["Cart"];
};
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
404: components["responses"]["NotFound"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["FulfillmentPreference"] | FulfillmentPreference |
components["schemas"]["Cart"] | Cart |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["NotFound"] | NotFound |
Request Body
Content Types: application/json
Responses
200
OK
400
Bad request
401
Not authorized for given operation on the Resource
404
Requested resource not found
OpenAPI Definition
json
{
"tags": [
"Carts"
],
"operationId": "update-fulfillment-preference",
"summary": "Update fulfillment preference",
"description": "Update fulfillment preference",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/update-fulfillment-preference",
"description": "API reference for the update-fulfillment-preference operation"
},
"requestBody": {
"description": "",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FulfillmentPreference"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"cart": {
"$ref": "#/components/schemas/Cart"
}
}
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "carts",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "updateFulfillmentPreference"
}Auto-generated from OpenAPI spec and TypeScript definitions