Skip to content

[Issue] Set price on quote item instead of base_price #38094

Open
@m2-assistant

Description

@m2-assistant

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 (*)

  1. Have 2 storeviews
  2. Configure "Stores > Configuration > General > Currency Setup" so that one of the 2 storeviews use different currency then the "default" values
  3. 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
  4. Create a new product, give it a price of 100
  5. Reindex, flush caches
  6. In frontend, visit the product on the 2 different storeviews, you should see 2 different prices and currencies if all goes well.
  7. On the storeview where the currency isn't the same as the "default" value, put the product in the cart
  8. Now inspect the database, the table quote_item, the columns price and base_price
  9. It's expected that the values aren't the same, the base_price should contain 100, the price 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions