in ordercreate graphql getting error Line items currency must be provided when either…
- 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
- 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
currencyCodefor the OrderIf 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
currencyCodeat the top level of yourdraftOrderCreateororderCreateinput.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_CODEto theinputobject. ReplaceEURwith the actual 3-letter currency code you want (e.g.,USD,CAD,GBP,JPY, etc.).Important Considerations:
- 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.
- Variant Prices: If you specify a
currencyCodefor 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
pricewithcurrencyCodefor Each Line ItemIf 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
priceobject for eachlineIteminput, including both theamountandcurrencyCode.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
currencyCodeat the order level is sufficient.In summary, choose the first option (adding
currencyCodeto the top-level input) unless you have a specific reason to provide custom prices for individual line items.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.