Skip to content

GraphQL Cart tax improvements for cart #33848

Open
@paales

Description

@paales

As a visitor I want to see prices in my cart with the proper tax formatting so that I can accurately view my prices.

AC

  • Discount should include price_incl_tax and price_excl_tax and amount should probably be deprecated?
  • SelectedShippingMethod should include price_incl_tax and price_excl_tax and amount should probably be deprecated?
  • CartItemPrices should include price_incl_tax
  • SelectedShippingMethod should provide including and excluding tax prices
  • StoreConfig should communicate how to render the cart

Suggested Schema

SelectedShippingMethod should include price_incl_tax and price_excl_tax and amount should probably be deprecated?

type Discount @doc(description:"Defines an individual discount. A discount can be applied to the cart as a whole or to an item.") {
amount: Money! @doc(description:"The amount of the discount.")
label: String! @doc(description:"A description of the discount.")
}

Should be:

type Discount @doc(description:"Defines an individual discount. A discount can be applied to the cart as a whole or to an item.") {
    amount: Money! @doc(description:"The amount of the discount.") @deprecated(reason: "use price_incl_tax and price_excl_tax")
    price_incl_tax: Money! @doc(description:"The amount of the discount including tax.")
    price_excl_tax: Money! @doc(description:"The amount of the discount excluding tax.")
    label: String! @doc(description:"A description of the discount.")
}

total_item_discount: Money @doc(description: "The total of all discounts applied to the item.")

Should be:

type CartItemPrices @doc(description: "Contains details about the price of the item, including taxes and discounts.") {
    #other stuff
    total_item_discount: Money @doc(description: "The total of all discounts applied to the item.") @deprecated(reason: "use total_item_discount_incl_tax or total_item_discount_excl_tax")
    total_item_discount_incl_tax: Money @doc(description: "The total of all discounts applied to the item.")
    total_item_discount_excl_tax: Money @doc(description: "The total of all discounts applied to the item.")
}

CartItemPrices should include price_incl_tax

price: Money! @doc(description: "The price of the item before any discounts were applied. The price that might include tax, depending on the configured display settings for cart.")

type CartItemPrices @doc(description: "Contains details about the price of the item, including taxes and discounts.") {
    price: Money! @doc(description: "The price of the item before any discounts were applied. The price that might include tax, depending on the configured display settings for cart.") @deprecated(reason: "use price_excl_tax or price_incl_tax instead")
    price_excluding_tax: Money! @doc(description: "The price of the item before any discounts were applied.")
    price_including_tax: Money! @doc(description: "The price of the item before any discounts were applied.")
    # other stuff
}

SelectedShippingMethod should provide including and excluding tax prices

type SelectedShippingMethod @doc(description: "Contains details about the selected shipping method and carrier.") {
carrier_code: String! @doc(description: "A string that identifies a commercial carrier or an offline shipping method.")
method_code: String! @doc(description: "A shipping method code associated with a carrier.")
carrier_title: String! @doc(description: "The label for the carrier code.")
method_title: String! @doc(description: "The label for the method code.")
amount: Money! @doc(description: "The cost of shipping using this shipping method.")
base_amount: Money @deprecated(reason: "The field should not be used on the storefront.")
}

Should be:

type SelectedShippingMethod @doc(description: "Contains details about the selected shipping method and carrier.") {
    carrier_code: String! @doc(description: "A string that identifies a commercial carrier or an offline shipping method.")
    method_code: String! @doc(description: "A shipping method code associated with a carrier.")
    carrier_title: String! @doc(description: "The label for the carrier code.")
    method_title: String! @doc(description: "The label for the method code.")
    amount: Money! @doc(description: "The cost of shipping using this shipping method.") @deprecated(reason "use price_incl_tax or price_excl_tax")
    price_incl_tax: Money!
    price_excl_tax: Money!
    base_amount: Money @deprecated(reason: "The field should not be used on the storefront.")
}

StoreConfig should communicate how to render the cart

enum CartTaxDisplayOptions {
    INCL
    EXCL
    BOTH
}

type StoreConfig {
    cart_display_prices: CartTaxDisplayOptions!
    cart_display_shipping_prices: CartTaxDisplayOptions!
    cart_display_subtotal: CartTaxDisplayOptions!
    cart_display_grandtotal: CartTaxDisplayOptions! #This will 
    cart_display_tax_summary: Boolean!
    cart_display_tax_when_zero: Boolean!
}

This will incorporate these settings:

Schermafbeelding 2022-03-10 om 13 33 12

(there are many more missing store config values, i can write them down, improve on them, etc. but one step at a time 😄 )

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Ready for Grooming

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions