Skip to content
The Chat Archive
gemini-2.5-flash· Google LMArena Human Preference 140K

in ordercreate graphql getting error Line items currency must be provided when either…

  1. User

    in ordercreate graphql getting error Line items currency must be provided when either order currency or order presentment currency is different from the shop currency

  2. Assistant

    This error message, "Line items currency must be provided when either order currency or order presentment currency is different from the shop currency," means that you're trying to create an order (or draft order) in a currency that is not your shop's default currency, but you haven't explicitly told Shopify what currency the prices of the individual line items are in.

    Shopify needs this information to correctly calculate totals, handle taxes, and ensure consistency when dealing with multiple currencies.

    Here's how to fix it, depending on your situation:

    The Most Common Fix: Specify currencyCode for the Order

    If you intend for the entire order to be in a specific currency (e.g., EUR instead of your shop's default USD), you must specify the currencyCode at the top level of your draftOrderCreate or orderCreate input.

    Example GraphQL Mutation (for draftOrderCreate):

    mutation DraftOrderCreateWithCurrency {
      draftOrderCreate(input: {
        currencyCode: EUR, # <-- Add this line!
        lineItems: [
          {
            variantId: "gid://shopify/ProductVariant/YOUR_VARIANT_ID_1",
            quantity: 1
          },
          {
            variantId: "gid://shopify/ProductVariant/YOUR_VARIANT_ID_2",
            quantity: 2
          }
        ],
        customer: {
          email: "test@example.com"
        },
        shippingAddress: {
          address1: "123 Main St",
          city: "Anytown",
          provinceCode: "ON",
          zip: "M1M 1M1",
          countryCode: CA,
          firstName: "John",
          lastName: "Doe"
        }
      }) {
        draftOrder {
          id
          currencyCode
          totalPrice
          lineItems(first: 5) {
            edges {
              node {
                title
                quantity
                originalUnitPrice {
                  amount
                  currencyCode
                }
              }
            }
          }
        }
        userErrors {
          field
          message
        }
      }
    }
    

    Key Change: Add currencyCode: YOUR_DESIRED_CURRENCY_CODE to the input object. Replace EUR with the actual 3-letter currency code you want (e.g., USD, CAD, GBP, JPY, etc.).

    Important Considerations:

    1. Shop Currency Settings: Your Shopify store must have the desired currency enabled in its multi-currency settings (Settings > Markets). If the currency is not enabled, the mutation will fail with a different error.
    2. Variant Prices: If you specify a currencyCode for the order, Shopify will automatically convert the variant's base price to that currency using the exchange rates configured in your Shopify store.

    Alternative Fix: Provide price with currencyCode for Each Line Item

    If you are overriding the default variant price for each line item (e.g., selling a product for a custom price, or a specific price in a different currency that doesn't rely on Shopify's automatic conversion), you must provide the price object for each lineItem input, including both the amount and currencyCode.

    Example:

    mutation DraftOrderCreateWithCustomLineItemPrices {
      draftOrderCreate(input: {
        lineItems: [
          {
            variantId: "gid://shopify/ProductVariant/YOUR_VARIANT_ID_1",
            quantity: 1,
            price: { # <-- Add this for each line item with custom price
              amount: "15.00",
              currencyCode: EUR # <-- The currency of this specific line item price
            }
          },
          {
            variantId: "gid://shopify/ProductVariant/YOUR_VARIANT_ID_2",
            quantity: 2,
            price: { # <-- And for this one
              amount: "25.50",
              currencyCode: EUR
            }
          }
        ],
        customer: {
          email: "test@example.com"
        }
        # You might still need order-level currencyCode if overall order currency is different
        # currencyCode: EUR 
      }) {
        draftOrder {
          id
          currencyCode
          totalPrice
          lineItems(first: 5) {
            edges {
              node {
                title
                quantity
                originalUnitPrice {
                  amount
                  currencyCode
                }
              }
            }
          }
        }
        userErrors {
          field
          message
        }
      }
    }
    

    This approach is less common unless you have specific pricing logic that bypasses Shopify's automatic currency conversion. Usually, setting the currencyCode at the order level is sufficient.

    In summary, choose the first option (adding currencyCode to the top-level input) unless you have a specific reason to provide custom prices for individual line items.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.