Anchor to section titled 'undefined'

fulfillmentCreateV2
mutation
deprecated

Requires write_assigned_fulfillment_orders access scope, write_merchant_managed_fulfillment_orders access scope or write_third_party_fulfillment_orders access scope. Also: The user must have fulfill_and_ship_orders permission.

Creates a fulfillment for one or many fulfillment orders. The fulfillment orders are associated with the same order and are assigned to the same location. Use fulfillmentCreate instead.


The input fields used to create a fulfillment from fulfillment orders.

An optional message for the fulfillment request.


Was this section helpful?

The created fulfillment.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
  fulfillmentCreateV2(fulfillment: $fulfillment) {
    fulfillment {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}
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 fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) { fulfillmentCreateV2(fulfillment: $fulfillment) { fulfillment { id status } userErrors { field message } } }",
 "variables": {
    "fulfillment": {
      "lineItemsByFulfillmentOrder": {
        "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/940656279"
      }
    }
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
    fulfillmentCreateV2(fulfillment: $fulfillment) {
      fulfillment {
        id
        status
      }
      userErrors {
        field
        message
      }
    }
  }`,
  {
    variables: {
      "fulfillment": {
        "lineItemsByFulfillmentOrder": {
          "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/940656279"
        }
      }
    },
  },
);

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 fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
    fulfillmentCreateV2(fulfillment: $fulfillment) {
      fulfillment {
        id
        status
      }
      userErrors {
        field
        message
      }
    }
  }
QUERY

variables = {
  "fulfillment": {
    "lineItemsByFulfillmentOrder": {
      "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/940656279"
    }
  }
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
      fulfillmentCreateV2(fulfillment: $fulfillment) {
        fulfillment {
          id
          status
        }
        userErrors {
          field
          message
        }
      }
    }`,
    "variables": {
      "fulfillment": {
        "lineItemsByFulfillmentOrder": {
          "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/940656279"
        }
      }
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
    fulfillmentCreateV2(fulfillment: $fulfillment) {
      fulfillment {
        id
        status
      }
      userErrors {
        field
        message
      }
    }
  }
QUERY;

$variables = [
  "fulfillment" => [
    "lineItemsByFulfillmentOrder" => [
      "fulfillmentOrderId" => "gid://shopify/FulfillmentOrder/940656279",
    ],
  ],
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "fulfillment": {
    "lineItemsByFulfillmentOrder": {
      "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/940656279"
    }
  }
}
Hide code
Response
JSON
{
  "fulfillmentCreateV2": {
    "fulfillment": {
      "id": "gid://shopify/Fulfillment/1069019872",
      "status": "SUCCESS"
    },
    "userErrors": []
  }
}