cartSetPurchaseOrderNumber
Record the buyer's own reference for this purchase, usually a purchase order number. It belongs to the company rather than the shopper, so only an associate of the business unit the cart belongs to may record one -- which is why this is part of the B2B schema and not the cart every storefront gets.
Pass null to clear a reference already recorded.
Arguments
| Argument | Type | Description |
|---|---|---|
id | ID! | |
version | String | |
purchaseOrderNumber | String |
Returns
CartSetPurchaseOrderNumberResponse!
| Field | Type | Description |
|---|---|---|
cartB2B | Cart | The cart carrying the reference |
cartErrorsB2B | [CartSetPurchaseOrderNumberError!] | Error details if the reference could not be recorded |
Example
mutation CartSetPurchaseOrderNumber( $id: ID! $version: String $purchaseOrderNumber: String) { cartSetPurchaseOrderNumber( id: $id version: $version purchaseOrderNumber: $purchaseOrderNumber ) { cart { id version createdAt lastModifiedAt currency customerEmail isGuest totalQuantity deliveryRemarks vatNumber purchaseOrderNumber deliverySplit requestedDeliveryDate earliestCompleteDeliveryDate name defaultName status } cartErrors { __typename ... on ValidationError { message } ... on CartError { message code } } }}{ "id": "id-1", "version": "Example", "purchaseOrderNumber": "Example"}{ "data": { "cartSetPurchaseOrderNumber": { "cart": { "id": "id-1", "version": "Example", "createdAt": "2026-10-01T09:30:00Z", "lastModifiedAt": "2026-10-01T09:30:00Z", "currency": "EUR", "customerEmail": "jane@example.com", "isGuest": true, "totalQuantity": 1, "deliveryRemarks": "Example", "vatNumber": "Example", "purchaseOrderNumber": "Example", "deliverySplit": "COMPLETE", "requestedDeliveryDate": "2026-10-01", "earliestCompleteDeliveryDate": "2026-10-01", "name": "Example", "defaultName": "Example", "status": "ACTIVE" }, "cartErrors": [ { "__typename": "ValidationError", "message": "Example" } ] } }}The query selects the return type's fields two levels deep; pick the ones you need. The response shows its shape with placeholder values.
Served by
| @evolve-framework/commercetools | Resolved |
| @evolve-framework/medusa | Resolved |
| @evolve-framework/sfcc | Not resolved |
Used by
The storefront packages that send it, in these GraphQL documents:
- @evolve-storefront/feature-cart:
CartSetPurchaseOrderNumber

