Anchor to section titled 'undefined'

fulfillmentEventCreate
mutation

Requires write_fulfillments access scope. Also: The user must have fulfill_and_ship_orders permission.

Creates a fulfillment event for a specified fulfillment.


The input fields used to create a fulfillment event for a fulfillment.


Was this section helpful?

The created fulfillment event.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation fulfillmentEventCreate($fulfillmentEvent: FulfillmentEventInput!) {
  fulfillmentEventCreate(fulfillmentEvent: $fulfillmentEvent) {
    fulfillmentEvent {
      id
      status
      message
    }
    userErrors {
      field
      message
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation fulfillmentEventCreate($fulfillmentEvent: FulfillmentEventInput!) { fulfillmentEventCreate(fulfillmentEvent: $fulfillmentEvent) { fulfillmentEvent { id status message } userErrors { field message } } }",
 "variables": {
    "fulfillmentEvent": {
      "fulfillmentId": "gid://shopify/Fulfillment/237894043",
      "address1": "151 O'\''Connor St",
      "city": "Ottawa",
      "province": "Ontario",
      "country": "Canada",
      "zip": "K2P 2L8",
      "latitude": 45.4191176,
      "longitude": 75.6966166,
      "happenedAt": "2024-03-07T15:50:00Z",
      "estimatedDeliveryAt": "2024-03-07T16:50:00Z",
      "message": "This package is now out for delivery!",
      "status": "OUT_FOR_DELIVERY"
    }
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation fulfillmentEventCreate($fulfillmentEvent: FulfillmentEventInput!) {
    fulfillmentEventCreate(fulfillmentEvent: $fulfillmentEvent) {
      fulfillmentEvent {
        id
        status
        message
      }
      userErrors {
        field
        message
      }
    }
  }`,
  {
    variables: {
      "fulfillmentEvent": {
        "fulfillmentId": "gid://shopify/Fulfillment/237894043",
        "address1": "151 O'Connor St",
        "city": "Ottawa",
        "province": "Ontario",
        "country": "Canada",
        "zip": "K2P 2L8",
        "latitude": 45.4191176,
        "longitude": 75.6966166,
        "happenedAt": "2024-03-07T15:50:00Z",
        "estimatedDeliveryAt": "2024-03-07T16:50:00Z",
        "message": "This package is now out for delivery!",
        "status": "OUT_FOR_DELIVERY"
      }
    },
  },
);

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 fulfillmentEventCreate($fulfillmentEvent: FulfillmentEventInput!) {
    fulfillmentEventCreate(fulfillmentEvent: $fulfillmentEvent) {
      fulfillmentEvent {
        id
        status
        message
      }
      userErrors {
        field
        message
      }
    }
  }
QUERY

variables = {
  "fulfillmentEvent": {
    "fulfillmentId": "gid://shopify/Fulfillment/237894043",
    "address1": "151 O'Connor St",
    "city": "Ottawa",
    "province": "Ontario",
    "country": "Canada",
    "zip": "K2P 2L8",
    "latitude": 45.4191176,
    "longitude": 75.6966166,
    "happenedAt": "2024-03-07T15:50:00Z",
    "estimatedDeliveryAt": "2024-03-07T16:50:00Z",
    "message": "This package is now out for delivery!",
    "status": "OUT_FOR_DELIVERY"
  }
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation fulfillmentEventCreate($fulfillmentEvent: FulfillmentEventInput!) {
      fulfillmentEventCreate(fulfillmentEvent: $fulfillmentEvent) {
        fulfillmentEvent {
          id
          status
          message
        }
        userErrors {
          field
          message
        }
      }
    }`,
    "variables": {
      "fulfillmentEvent": {
        "fulfillmentId": "gid://shopify/Fulfillment/237894043",
        "address1": "151 O'Connor St",
        "city": "Ottawa",
        "province": "Ontario",
        "country": "Canada",
        "zip": "K2P 2L8",
        "latitude": 45.4191176,
        "longitude": 75.6966166,
        "happenedAt": "2024-03-07T15:50:00Z",
        "estimatedDeliveryAt": "2024-03-07T16:50:00Z",
        "message": "This package is now out for delivery!",
        "status": "OUT_FOR_DELIVERY"
      }
    },
  },
});
use Shopify\Clients\Graphql;

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

$variables = [
  "fulfillmentEvent" => [
    "fulfillmentId" => "gid://shopify/Fulfillment/237894043",
    "address1" => "151 O'Connor St",
    "city" => "Ottawa",
    "province" => "Ontario",
    "country" => "Canada",
    "zip" => "K2P 2L8",
    "latitude" => 45.4191176,
    "longitude" => 75.6966166,
    "happenedAt" => "2024-03-07T15:50:00Z",
    "estimatedDeliveryAt" => "2024-03-07T16:50:00Z",
    "message" => "This package is now out for delivery!",
    "status" => "OUT_FOR_DELIVERY",
  ],
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "fulfillmentEvent": {
    "fulfillmentId": "gid://shopify/Fulfillment/237894043",
    "address1": "151 O'Connor St",
    "city": "Ottawa",
    "province": "Ontario",
    "country": "Canada",
    "zip": "K2P 2L8",
    "latitude": 45.4191176,
    "longitude": 75.6966166,
    "happenedAt": "2024-03-07T15:50:00Z",
    "estimatedDeliveryAt": "2024-03-07T16:50:00Z",
    "message": "This package is now out for delivery!",
    "status": "OUT_FOR_DELIVERY"
  }
}
Hide code
Response
JSON
{
  "fulfillmentEventCreate": {
    "fulfillmentEvent": {
      "id": "gid://shopify/FulfillmentEvent/944956391",
      "status": "OUT_FOR_DELIVERY",
      "message": "This package is now out for delivery!"
    },
    "userErrors": []
  }
}