Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Automatically fulfill line items that contain a specific product

Automatically fulfill line items that contain a specific product

ZSAGI
Shopify Partner
1 0 0

Hi, 

Is there a way to use Flows and a GraphQL call to automatically fulfill order line items that contain a specific SKU and do so without triggering an email notification to the customer? I'm familiar with GraphQL commands but am having difficulty with the fulfillmentCreateV2 mutation and am unsure if this is the correct command.

 

Thanks

Reply 1 (1)

Liam
Community Manager
3108 344 891

Hi ZSAGI,

 

To automatically fulfill order line items with a specific SKU using Shopify's GraphQL API and ensure that no email notification is sent to the customer, you can indeed use the fulfillmentCreateV2 mutation. This mutation allows you to create a fulfillment for specific line items in an order.

 

There's also a `notifyCustomer` field that you can set to `false` to prevent a notification from being sent. It would look something like:

 

mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
  fulfillmentCreateV2(fulfillment: $fulfillment) {
    fulfillment {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

// Variables:

{
  "fulfillment": {
    "lineItemsByFulfillmentOrder": [
      {
        "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/123456789",
        "fulfillmentOrderLineItems": [
          {
            "id": "gid://shopify/FulfillmentOrderLineItem/987654321",
            "quantity": 1
          }
        ]
      }
    ],
    "trackingInfo": {
      "company": "Custom Carrier",
      "number": "1234567890",
      "url": "https://www.customcarrier.com/track/1234567890"
    },
    "notifyCustomer": false
  }
}

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog