B2B feature. Learn more
addPurchaseOrderItemsToCart mutation
The addPurchaseOrderItemsToCart
mutation adds all purchase order items to the shopping cart. The request must specify a cart_id
and a purchase_order_uid
. If the value of replace_existing_cart_items
is set to true
, the mutation deletes the pre-existing items from the purchase order. Otherwise, the mutation merges the pre-existing items with the new items.
Syntax
Copied to your clipboardmutation {addPurchaseOrderItemsToCart(input: AddPurchaseOrderItemsToCartInput!){AddProductsToCartOutput}}
Reference
The addPurchaseOrderItemsToCart
reference provides detailed information about the types and fields defined in this mutation.
Example usage
The following example adds all purchase order items to the shopping cart.
Request:
Copied to your clipboardmutation {addPurchaseOrderItemsToCart(input: {purchase_order_uid: "MQ==",cart_id: "hJUrIcPm77uCyYkSTBRGyjSvS40mw1Qd",replace_existing_cart_items: false}) {cart {iditems {product {sku}}}user_errors {messagecode}}}
Response:
Copied to your clipboard{"data": {"addPurchaseOrderItemsToCart": {"cart": {"id": "hJUrIcPm77uCyYkSTBRGyjSvS40mw1Qd","items": [{"product": {"sku": "Simple product"}}]},"user_errors": []}}}