Requires write_orders access scope. Also: User needs manage_orders_information permission.

Creates an order.


Service options for the mutation.

The input for the mutation.


Was this section helpful?

The order that was created.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation OrderCreate($order: OrderCreateOrderInput!, $options: OrderCreateOptionsInput) {
  orderCreate(order: $order, options: $options) {
    userErrors {
      field
      message
    }
    order {
      id
      totalTaxSet {
        shopMoney {
          amount
          currencyCode
        }
      }
      lineItems(first: 5) {
        nodes {
          variant {
            id
          }
          id
          title
          quantity
          taxLines {
            title
            rate
            priceSet {
              shopMoney {
                amount
                currencyCode
              }
            }
          }
        }
      }
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation OrderCreate($order: OrderCreateOrderInput!, $options: OrderCreateOptionsInput) { orderCreate(order: $order, options: $options) { userErrors { field message } order { id totalTaxSet { shopMoney { amount currencyCode } } lineItems(first: 5) { nodes { variant { id } id title quantity taxLines { title rate priceSet { shopMoney { amount currencyCode } } } } } } } }",
 "variables": {
    "order": {
      "currency": "EUR",
      "lineItems": [
        {
          "title": "Big Brown Bear Boots",
          "priceSet": {
            "shopMoney": {
              "amount": 74.99,
              "currencyCode": "EUR"
            }
          },
          "quantity": 3,
          "taxLines": [
            {
              "priceSet": {
                "shopMoney": {
                  "amount": 10.2,
                  "currencyCode": "EUR"
                }
              },
              "rate": 0.06,
              "title": "State tax"
            }
          ]
        }
      ],
      "transactions": [
        {
          "kind": "SALE",
          "status": "SUCCESS",
          "amountSet": {
            "shopMoney": {
              "amount": 238.47,
              "currencyCode": "EUR"
            }
          }
        }
      ]
    }
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation OrderCreate($order: OrderCreateOrderInput!, $options: OrderCreateOptionsInput) {
    orderCreate(order: $order, options: $options) {
      userErrors {
        field
        message
      }
      order {
        id
        totalTaxSet {
          shopMoney {
            amount
            currencyCode
          }
        }
        lineItems(first: 5) {
          nodes {
            variant {
              id
            }
            id
            title
            quantity
            taxLines {
              title
              rate
              priceSet {
                shopMoney {
                  amount
                  currencyCode
                }
              }
            }
          }
        }
      }
    }
  }`,
  {
    variables: {
      "order": {
        "currency": "EUR",
        "lineItems": [
          {
            "title": "Big Brown Bear Boots",
            "priceSet": {
              "shopMoney": {
                "amount": 74.99,
                "currencyCode": "EUR"
              }
            },
            "quantity": 3,
            "taxLines": [
              {
                "priceSet": {
                  "shopMoney": {
                    "amount": 10.2,
                    "currencyCode": "EUR"
                  }
                },
                "rate": 0.06,
                "title": "State tax"
              }
            ]
          }
        ],
        "transactions": [
          {
            "kind": "SALE",
            "status": "SUCCESS",
            "amountSet": {
              "shopMoney": {
                "amount": 238.47,
                "currencyCode": "EUR"
              }
            }
          }
        ]
      }
    },
  },
);

const data = await response.json();
session = ShopifyAPI::Auth::Session.new(
  shop: "your-development-store.myshopify.com",
  access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
  session: session
)

query = <<~QUERY
  mutation OrderCreate($order: OrderCreateOrderInput!, $options: OrderCreateOptionsInput) {
    orderCreate(order: $order, options: $options) {
      userErrors {
        field
        message
      }
      order {
        id
        totalTaxSet {
          shopMoney {
            amount
            currencyCode
          }
        }
        lineItems(first: 5) {
          nodes {
            variant {
              id
            }
            id
            title
            quantity
            taxLines {
              title
              rate
              priceSet {
                shopMoney {
                  amount
                  currencyCode
                }
              }
            }
          }
        }
      }
    }
  }
QUERY

variables = {
  "order": {
    "currency": "EUR",
    "lineItems": [{"title"=>"Big Brown Bear Boots", "priceSet"=>{"shopMoney"=>{"amount"=>74.99, "currencyCode"=>"EUR"}}, "quantity"=>3, "taxLines"=>[{"priceSet"=>{"shopMoney"=>{"amount"=>10.2, "currencyCode"=>"EUR"}}, "rate"=>0.06, "title"=>"State tax"}]}],
    "transactions": [{"kind"=>"SALE", "status"=>"SUCCESS", "amountSet"=>{"shopMoney"=>{"amount"=>238.47, "currencyCode"=>"EUR"}}}]
  }
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation OrderCreate($order: OrderCreateOrderInput!, $options: OrderCreateOptionsInput) {
      orderCreate(order: $order, options: $options) {
        userErrors {
          field
          message
        }
        order {
          id
          totalTaxSet {
            shopMoney {
              amount
              currencyCode
            }
          }
          lineItems(first: 5) {
            nodes {
              variant {
                id
              }
              id
              title
              quantity
              taxLines {
                title
                rate
                priceSet {
                  shopMoney {
                    amount
                    currencyCode
                  }
                }
              }
            }
          }
        }
      }
    }`,
    "variables": {
      "order": {
        "currency": "EUR",
        "lineItems": [
          {
            "title": "Big Brown Bear Boots",
            "priceSet": {
              "shopMoney": {
                "amount": 74.99,
                "currencyCode": "EUR"
              }
            },
            "quantity": 3,
            "taxLines": [
              {
                "priceSet": {
                  "shopMoney": {
                    "amount": 10.2,
                    "currencyCode": "EUR"
                  }
                },
                "rate": 0.06,
                "title": "State tax"
              }
            ]
          }
        ],
        "transactions": [
          {
            "kind": "SALE",
            "status": "SUCCESS",
            "amountSet": {
              "shopMoney": {
                "amount": 238.47,
                "currencyCode": "EUR"
              }
            }
          }
        ]
      }
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation OrderCreate($order: OrderCreateOrderInput!, $options: OrderCreateOptionsInput) {
    orderCreate(order: $order, options: $options) {
      userErrors {
        field
        message
      }
      order {
        id
        totalTaxSet {
          shopMoney {
            amount
            currencyCode
          }
        }
        lineItems(first: 5) {
          nodes {
            variant {
              id
            }
            id
            title
            quantity
            taxLines {
              title
              rate
              priceSet {
                shopMoney {
                  amount
                  currencyCode
                }
              }
            }
          }
        }
      }
    }
  }
QUERY;

$variables = [
  "order" => [
    "currency" => "EUR",
    "lineItems" => [{"title"=>"Big Brown Bear Boots", "priceSet"=>{"shopMoney"=>{"amount"=>74.99, "currencyCode"=>"EUR"}}, "quantity"=>3, "taxLines"=>[{"priceSet"=>{"shopMoney"=>{"amount"=>10.2, "currencyCode"=>"EUR"}}, "rate"=>0.06, "title"=>"State tax"}]}],
    "transactions" => [{"kind"=>"SALE", "status"=>"SUCCESS", "amountSet"=>{"shopMoney"=>{"amount"=>238.47, "currencyCode"=>"EUR"}}}],
  ],
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "order": {
    "currency": "EUR",
    "lineItems": [
      {
        "title": "Big Brown Bear Boots",
        "priceSet": {
          "shopMoney": {
            "amount": 74.99,
            "currencyCode": "EUR"
          }
        },
        "quantity": 3,
        "taxLines": [
          {
            "priceSet": {
              "shopMoney": {
                "amount": 10.2,
                "currencyCode": "EUR"
              }
            },
            "rate": 0.06,
            "title": "State tax"
          }
        ]
      }
    ],
    "transactions": [
      {
        "kind": "SALE",
        "status": "SUCCESS",
        "amountSet": {
          "shopMoney": {
            "amount": 238.47,
            "currencyCode": "EUR"
          }
        }
      }
    ]
  }
}
Hide code
Response
JSON
{
  "orderCreate": {
    "userErrors": [],
    "order": {
      "id": "gid://shopify/Order/1073460338",
      "totalTaxSet": {
        "shopMoney": {
          "amount": "10.2",
          "currencyCode": "EUR"
        }
      },
      "lineItems": {
        "nodes": [
          {
            "variant": null,
            "id": "gid://shopify/LineItem/1071823546",
            "title": "Big Brown Bear Boots",
            "quantity": 3,
            "taxLines": [
              {
                "title": "State tax",
                "rate": 0.06,
                "priceSet": {
                  "shopMoney": {
                    "amount": "10.2",
                    "currencyCode": "EUR"
                  }
                }
              }
            ]
          }
        ]
      }
    }
  }
}