Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Wrong response body when adding cart item to cart #275

Open
juju-ba opened this issue Jul 11, 2023 · 0 comments
Open

Wrong response body when adding cart item to cart #275

juju-ba opened this issue Jul 11, 2023 · 0 comments

Comments

@juju-ba
Copy link

juju-ba commented Jul 11, 2023

When creating a cart with a product, which has an automatic discount applied like "Buy 3(n) and get 10% off", the (n+1) product added is not added to the cost of the line item.

Creating cart mutation
mutation { cartCreate( input: {lines: {merchandiseId: "gid://shopify/ProductVariant/44134907969855", quantity: 1}, buyerIdentity: {countryCode: DE, deliveryAddressPreferences: {deliveryAddress: {firstName: "Max", lastName: "Mustermann", country: "Germany", city: "Musterstadt", zip: "83772", address1: "Musterstrasse 1"}}}} ) { userErrors { message } cart { checkoutUrl id cost { totalTaxAmount { amount } totalAmount { amount } subtotalAmount { amount } } lines(first: 1) { edges { node { quantity id sellingPlanAllocation { priceAdjustments { price { amount } } } merchandise { ... on ProductVariant { image { url } title id price { amount } sellingPlanAllocations(first: 1) { edges { node { priceAdjustments { price { amount } } } } } } } } } } } } }

Mutation to add a single product
mutation { cartLinesAdd( cartId: "gid://shopify/Cart/c1-df9ac8e71b99a136405e930b4d60e44f" lines: {merchandiseId: "gid://shopify/ProductVariant/44134907969855", quantity: 1} ) { userErrors { message } cart { checkoutUrl id cost { subtotalAmount { amount } totalAmount { amount } } lines(first: 30) { edges { node { quantity id merchandise { ... on ProductVariant { image { url } title id price { amount } } } sellingPlanAllocation { sellingPlan { id } priceAdjustments { price { amount } } } cost { totalAmount { amount } amountPerQuantity { amount } compareAtAmountPerQuantity { amount } subtotalAmount { amount } } discountAllocations { discountedAmount { amount } } } } } } } }

Example response adding 6 items of a product with "Buy 5 and get 20% off"

Bildschirm­foto 2023-07-11 um 23 07 15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant