Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cart unit item price is shown in wrong currency if custom_price is used #27161

Closed
borriglione opened this issue Mar 4, 2020 · 13 comments
Closed
Labels
Component: Pricing Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Priority: P3 May be fixed according to the position in the backlog. Progress: done Reported on 2.3.4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. stale issue

Comments

@borriglione
Copy link

borriglione commented Mar 4, 2020

Preconditions

  1. Magento 2.3.4
  2. Multi-Currency Setup
  3. quote_item.custom_price is used

Steps to reproduce (*)

  1. Install Magento 2.3.4
  2. Deploy sample data
  3. Default currency is already US-Dollar (USD)
  4. Add 2nd allow currency f.e. EURO (EUR)
  5. Set rate f.e. 1 USD = 1.5 EUR
  6. Switch to EUR by currency switcher in frontend
  7. Add product with qty 2 in cart.
  8. Set a custom item price by observer or in the database quote_item.custom_price
  9. Open cart page

Sample:

$item->setCustomPrice(10)
$item->setOriginalCustomPrice(10)

Expected result (*)

I would expect to see:

  • Item unit price: 15 EUR
  • Row subtotal: 30 EUR

Actual result (*)

  • Item unit price: 10 EUR
  • Row subtotal: 30 EUR

It seems that quote_item.custom_price is currently always stored in base currency which is then not converted during cart item output.

Suggestion

Best practice would be to have 4 columns for quote_item

  • base_custom_price
  • custom_price
  • base_original_custom_price
  • original_custom_price

Additional info from engcom

  • Stores - Currency - Currency Rates
    eurotousd

  • Magento 2 Database, quote_item table custom_price set to 10
    quote_cust_price

  • Storefront, 2 itmes added to Cart
    10x2

@m2-assistant
Copy link

m2-assistant bot commented Mar 4, 2020

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

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

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.

@borriglione do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Mar 4, 2020
@engcom-Bravo engcom-Bravo self-assigned this Mar 16, 2020
@m2-assistant
Copy link

m2-assistant bot commented Mar 16, 2020

Hi @engcom-Bravo. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo
Copy link
Contributor

engcom-Bravo commented Mar 16, 2020

Hello @borriglione

Thank you for your report.

We are able to reproduce this behavior on Magento 2.4-develop, and we have added additional info to the description

@engcom-Bravo engcom-Bravo added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Component: Pricing Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Mar 16, 2020
@ghost ghost unassigned engcom-Bravo Mar 16, 2020
@kiennt1989
Copy link

Hi @borriglione
I think this issue is false case testing. relate to :
#12493

@alexryall
Copy link

Took me a while to figure out but vendor/magento/module-tax/Model/Sales/Total/Quote/CommonTaxCollector.php:692

$quoteItem->setCustomPrice($baseItemTaxDetails->getPrice());

should be:

$quoteItem->setCustomPrice($itemTaxDetails->getPrice());

@sdzhepa sdzhepa added Priority: P3 May be fixed according to the position in the backlog. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Aug 18, 2020
@sidolov sidolov added this to Ready for Development in Low Priority Backlog Sep 24, 2020
@magento-engcom-team magento-engcom-team added the Reported on 2.3.4 Indicates original Magento version for the Issue report. label Nov 13, 2020
@m2-community-project m2-community-project bot removed this from Ready for Dev in Community Backlog Nov 13, 2020
@stale
Copy link

stale bot commented Jan 29, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

@stale stale bot added the stale issue label Jan 29, 2021
@stale stale bot closed this as completed Feb 12, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Done in Low Priority Backlog Feb 12, 2021
@koushikch7
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @koushikch7. Thank you for your request. I'm working on Magento instance for you.

@ticaje
Copy link

ticaje commented Jun 14, 2021

I'm facing exactly the same issue even with version 2.4.2. The changing currency via default switcher prices remain the same on shopping cart.

@zexperto
Copy link

I could find a solution for this using currency convert function in this class [ \Magento\Directory\Model\Currency ]

$currency is instance of \Magento\Directory\Model\Currency
$correct_price = $currency->convert({your price}, {current store currency});

then

$quoteItem->setCustomPrice($correct_price);
$quoteItem->setOriginalCustomPrice($correct_price);

this was not working on 2.3.x but now it looks working on 2.4.3

@maheshmakwana-code
Copy link

I fixed the issue. Please check this : #33134 (comment)

@araujophillips
Copy link

araujophillips commented Nov 2, 2023

I fixed the issue. Please check this : #33134 (comment)

The core bug it's not solved with this. It's more a workaround.

Please check out my comments here @maheshmakwana-code : #33134 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Pricing Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Priority: P3 May be fixed according to the position in the backlog. Progress: done Reported on 2.3.4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. stale issue
Projects
Development

No branches or pull requests