data-src=../../../../../includes/commerce-only.md

placePurchaseOrder mutation

The placePurchaseOrder mutation places a purchase order using the specified cart_id. If the request is successful, the status of the purchase order is ORDER_PLACED.

data-variant=info
data-slots=text
To convert a purchase order to an order using the purchase order UID instead of the cart ID, use the placeOrderforPurchase mutation.

Syntax

mutation {
    placePurchaseOrder(
        input: PlacePurchaseOrderInput!
    ) {
        PlacePurchaseOrderOutput
    }
}

Reference

The placePurchaseOrder reference provides detailed information about the types and fields defined in this mutation.

Example usage

The following example places a purchase order.

Request:

mutation {
  placePurchaseOrder(
    input: {
        cart_id: "hJUrIcPm77uCyYkSTBRGyjSvS40mw1Qd"
    }
  ) {
    purchase_order {
        number
    }
  }
}

Response:

{
  "data": {
    "placePurchaseOrder": {
      "purchase_order": {
        "number": "000000002"
      }
    }
  }
}