magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.47k stars 9.28k forks source link

GraphQL Cart tax improvements for cart #33848

Open paales opened 3 years ago

paales commented 3 years ago

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

Suggested Schema

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

https://github.com/magento/magento2/blob/8de016a35bbd3d668f10046af1007ce69a9ee86f/app/code/Magento/QuoteGraphQl/etc/schema.graphqls#L356-L359

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.")
}

https://github.com/magento/magento2/blob/8de016a35bbd3d668f10046af1007ce69a9ee86f/app/code/Magento/QuoteGraphQl/etc/schema.graphqls#L366

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

https://github.com/magento/magento2/blob/8de016a35bbd3d668f10046af1007ce69a9ee86f/app/code/Magento/QuoteGraphQl/etc/schema.graphqls#L362

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

https://github.com/magento/magento2/blob/8de016a35bbd3d668f10046af1007ce69a9ee86f/app/code/Magento/QuoteGraphQl/etc/schema.graphqls#L263-L270

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

m2-assistant[bot] commented 3 years ago

Hi @paales. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 2 years ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

m2-assistant[bot] commented 2 years ago

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-November commented 2 years ago

Hi @paales , As per official Magento dev docs, this is an expected behavior "price_excl_tax" and ""price_incl_tax"" are available for available_shipping_methods but not for Discount. "SelectedShippingMethod" has amount only but not price_incl_tax and price_excl_tax Hence implementing these features can be considered as a feature request but not as a bug. Hence labeling this as feature request. image image

image