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.55k stars 9.32k forks source link

2.4.5 EE quote total collector collect billing address totals #37346

Open alexmtch opened 1 year ago

alexmtch commented 1 year ago

Preconditions and environment

Steps to reproduce

Add a product to cart using a graphql request

Expected result

Billing address should not be used to collect totals

Actual result

Billing address is to collect totals and because it's a billing, it's totals will always return no charges which is a waste of execution time.

Additional information

In vendor/magento/module-quote/Model/Quote/TotalsCollector.php collect method

Why foreach ($quote->getAllAddresses() as $address) { ?

Using $quote->getAllAddresses() will return all adresses including billing. In this case why the billing is usefull to collect totals ?

We could not use here $quote->getAllShippingAddresses() ?

We can see in the bellow example there is 2 executions of collectAddressTotals (one for my billing and one for my shipping). It could optimise the add to cart process to make this changes.

image

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @alexmtch. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 1 year 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:

github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-9195 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

engcom-November commented 1 year ago

Hello @alexmtch,

Thank you for reporting and collaboration.

We have tried to reproduce this on 2.4-develop. The issue seem to be reproduible when debugging app/code/Magento/Quote/Model/Quote/TotalsCollector.php

Please refer the screenshots below: image Here we can see the $quote->getAllAddresses() method is collecting totals from billing address which amounts to 0.

image Here it is collecting the totals from shipping address.

Hence confirming the issue.

Thanks.