Skip to content
This repository was archived by the owner on Nov 20, 2023. It is now read-only.
This repository was 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

Description

@juju-ba

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions