younifyd
Menu

draftOrderAvailableDeliveryOptions

Available delivery options for a DraftOrder based on the provided input. The query returns shipping rates, local delivery rates, and pickup locations that merchants can choose from when creating draft orders.

Use it in a workflow

  1. Add a step and choose the Shopify connector.
  2. Pick the draftOrderAvailableDeliveryOptions action (under Draft).
  3. Fill in the fields below, then reference the result from later steps as {{draftorderavailabledeliveryoptions.response.data}}.

Query

This is the query the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
query DraftOrderAvailableDeliveryOptions($input: DraftOrderAvailableDeliveryOptionsInput!, $search: String, $localPickupFrom: Int, $localPickupCount: Int, $sessionToken: String) {
  draftOrderAvailableDeliveryOptions(
    input: $input
    search: $search
    localPickupFrom: $localPickupFrom
    localPickupCount: $localPickupCount
    sessionToken: $sessionToken
  ) {
    availableLocalDeliveryRates {
      code
      handle
      price {
        amount
        currencyCode
      }
      source
      title
    }
    availableLocalPickupOptions {
      code
      distanceFromBuyer {
        unit
        value
      }
      handle
      instructions
      locationId
      source
      title
    }
    availableShippingRates {
      code
      handle
      price {
        amount
        currencyCode
      }
      source
      title
    }
    pageInfo {
      endCursor
      hasNextPage
      hasPreviousPage
      startCursor
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

inputobjectrequired

The fields for the draft order.

appliedDiscountobject6 fields
discountCodesarray<string>
acceptAutomaticDiscountsboolean
lineItemsarray<object>17 fields
shippingAddressobject13 fields
marketRegionCountryCodestring

One ofAFAXALDZADAOAIAGARAMAWACAUATAZBSBHBDBBBYBEBZBJBMBTBOBABWBVBRIOBNBGBFBIKHCACVBQKY

purchasingEntityobject2 fields
searchstring

The search term for the delivery options.

localPickupFromnumber

The offset for the local pickup options.

localPickupCountnumber

The number of local pickup options required.

sessionTokenstring

Unique token used to trace execution and help optimize the calculation.

json
{
  "input": {
    "appliedDiscount": {
      "value": 0,
      "valueType": "FIXED_AMOUNT",
      "amount": "string",
      "amountWithCurrency": {
        "amount": "string",
        "currencyCode": "string"
      },
      "description": "string",
      "title": "string"
    },
    "discountCodes": [
      "string"
    ],
    "acceptAutomaticDiscounts": false,
    "lineItems": [
      {
        "quantity": "string",
        "appliedDiscount": "string",
        "customAttributes": "string",
        "grams": "string",
        "originalUnitPrice": "string",
        "originalUnitPriceWithCurrency": "string",
        "requiresShipping": "string",
        "sku": "string",
        "taxable": "string",
        "title": "string",
        "variantId": "string",
        "weight": "string"
      }
    ],
    "shippingAddress": {
      "address1": "string",
      "address2": "string",
      "city": "string",
      "company": "string",
      "country": "string",
      "countryCode": "AF",
      "firstName": "string",
      "id": "string",
      "lastName": "string",
      "phone": "string",
      "province": "string",
      "provinceCode": "string"
    },
    "marketRegionCountryCode": "AF",
    "purchasingEntity": {
      "customerId": "string",
      "purchasingCompany": {
        "companyId": "string",
        "companyContactId": "string",
        "companyLocationId": "string"
      }
    }
  },
  "search": "string",
  "localPickupFrom": 0,
  "localPickupCount": 0,
  "sessionToken": "string"
}

Response

Read the result with {{draftorderavailabledeliveryoptions.response.data.data.draftOrderAvailableDeliveryOptions}}. If the API returns errors, the step fails and they are at {{draftorderavailabledeliveryoptions.response.data.errors}}.

availableLocalDeliveryRatesarray<object>
codeobject
handleobject
priceobject
sourceobject
titleobject
availableLocalPickupOptionsarray<object>
codeobject
distanceFromBuyerobject
handleobject
instructionsobject
locationIdobject
sourceobject
titleobject
availableShippingRatesarray<object>
codeobject
handleobject
priceobject
sourceobject
titleobject
pageInfoobject
endCursorstring
hasNextPageboolean
hasPreviousPageboolean
startCursorstring

Need more? See the Shopify guide for connection setup and behaviour shared by every action.

draftOrderAvailableDeliveryOptions — Shopify — Documentation