Prices not updating for products before creating order with GraphQL API

Hi

I use draftOrderCreate and draftOrderComplete to create orders to log sales from elsewhere.

Sometimes items will sell for a different price to Shopify. So I use productVariantsBulkUpdate to update the price before referencing the item by Shopify Variant Id when creating an order via draftOrderCreate.

When I check the item itself (listing page), the price update worked. However the problem is the price change does not reflect in the order, neither under list item pricing nor for subtotals, both of which you cannot change from DraftOrderCreate.

Please help me with a solution. I have been struggling for months. Have already tried spacing out time between price update and order creation (15 minute delay)

1 Like

Hey @FLUF_Team :waving_hand: - hoping I’m understanding things correctly here, but if you’re looking at overriding a draft order’s pricing for a particular item while it’s being created, you should be able to do that on the line items themselves like this (more info here):

mutation draftOrderCreateWithCustomPrice($input: DraftOrderInput!) {
  draftOrderCreate(input: $input) {
    draftOrder {
      id
      name
      email
      lineItems(first: 10) {
        edges {
          node {
            id
            title
            variant {
              id
              price
            }
            quantity
          }
        }
      }
    }
    userErrors {
      field
      message
    }
  }
}

variables:

{
  "input": {
    "note": "Draft order with custom pricing for specific item.",
    "email": "customer@example.com",
    "presentmentCurrencyCode": "CAD",
    "lineItems": [
      {
        "variantId": "gid://shopify/ProductVariant/47123590742038",
        "quantity": 2,
        "priceOverride": {
          "amount": "80.50",
          "currencyCode": "CAD"
        }
      },
      {
        "title": "Special Custom Service",
        "quantity": 1,
        "originalUnitPriceWithCurrency": {
          "amount": "100.00",
          "currencyCode": "USD"
        },
        "requiresShipping": false,
        "taxable": true
      }
    ],
    "shippingAddress": {
      "firstName": "John",
      "lastName": "Doe",
      "address1": "123 Fake St",
      "city": "Anytown",
      "provinceCode": "CA",
      "countryCode": "US",
      "zip": "12345",
      "phone": "555-555-5555"
    }
  }
}

By setting the priceOverride value, it should then have the price for the variant line item be modified like this in your draft order:

Hope this helps! :slight_smile:

Oh my goodness. I can’t believe I haven’t seen that. I’m embarrassed and ashamed :D. Thanks so much. I had to be reading old docs (see it got added in the 2025-01 version)

1 Like