Description
This issue is automatically created based on existing pull request: #36878: Set price on quote item instead of base_price
Description (*)
For some unknown reason, a quote item's price gets incorrectly set to the base_price instead of the price.
Which means that if you have multiple currencies in one website on the frontend, both price & base_price are stored in the database in the base currency. We would expect the price to be in the other currency and not the base currency.
The comment above the changed line of code seems to indicate this was done on purpose, but I have no idea why.
The base_price is set correctly on the quote item. It's just the price itself that seems to be wrong.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
- Have 2 storeviews
- Configure "Stores > Configuration > General > Currency Setup" so that one of the 2 storeviews use different currency then the "default" values
- Check in backoffice under "Stores > Currency > Currency Rates" that the 2 currencies aren't exactly the same rate, if they are the same, manually add some dummy exchange rate
- Create a new product, give it a price of 100
- Reindex, flush caches
- In frontend, visit the product on the 2 different storeviews, you should see 2 different prices and currencies if all goes well.
- On the storeview where the currency isn't the same as the "default" value, put the product in the cart
- Now inspect the database, the table
quote_item
, the columnsprice
andbase_price
- It's expected that the values aren't the same, the
base_price
should contain100
, theprice
should contain the value from the other currency.
Questions or comments
I don't have the knowledge or time and energy to add a new automated test for this scenario, so it would be appreciated if assistance can be given here for this.
Contribution checklist (*)
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- All new or changed code is covered with unit/integration tests (if applicable)
- README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
- All automated tests passed successfully (all builds are green)