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.51k stars 9.31k forks source link

Final price not considering store scope? #35903

Open Aquive opened 2 years ago

Aquive commented 2 years ago

Preconditions and environment

Steps to reproduce

  1. Add a product to the system for say €50
  2. Assign the product to both websites (website 1 and website 2)
  3. Make a new catalog rule with 50% off specific for the SKU of the added product, assign the catalog rule only to website 1
  4. Check the product in both frontends of website 1 and 2 to see if the prices are correct. Website 1 should list the product for €50. Website 2 should list it for €25.

Now spin up Magento 2 in a script and execute the following:

// Website 1
$product = $objectManager->create('Magento\Catalog\Model\Product')->setStoreId(1)->load(1);
echo $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue() . PHP_EOL;

// Website 2
$product = $objectManager->create('Magento\Catalog\Model\Product')->setStoreId(2)->load(1);
echo $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue() . PHP_EOL;

Expected result

I expect the final prices reflect the prices like the storefronts. So:

25 50

Actual result

The system doesn't seem to consider the scope when outputting the price. The output of the two lines of code is like this:

25 25

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 2 years ago

Hi @Aquive. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

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:

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

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


: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, join the Community Contributions Triage session to discuss the appropriate ticket.

: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-Dash. 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-Echo. 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-Echo commented 2 years ago

Hello @Aquive,

Thanks for the report and collaboration!

We have tried to reproduce the issue in Magento 2.4-develop branch, but for us, the issue is not reproducible. followed steps. website1

image

website2 with apply the catalog price rule on particular SKU.

image

Please check if i missed anything and kindly check on Magento 2.4-develop branch and provide more information with exact steps and screenshot so that we can reproduce this issue.

Thanks

Aquive commented 2 years ago

Hi @engcom-Echo thanks for the effort.

The reported problem does not arise on the frontend. It does hover arise when trying to retrieve the prices in the codebase of Magento. I supplied the (simplified) lines in the report. Shouldn't those lines reflect the same price as in the frontend? Because they don't.

engcom-Echo commented 2 years ago

Hello @Aquive,

Thanks for contribution and collaboration.

We have check on behalf of lines of code and getting the same price for both store on website 2 where we have apply the catalog price rule. Hence we are confirming the issue.

Steps to reproduced.

// Website 1
$product = $objectManager->create('Magento\Catalog\Model\Product')->setStoreId(1)->load(1);
echo $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue() . PHP_EOL;

// Website 2
$product = $objectManager->create('Magento\Catalog\Model\Product')->setStoreId(2)->load(1);
echo $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue() . `PHP_EOL;`

Please find the attached screen.

image

Thanks

github-jira-sync-bot commented 2 years ago

:x: Something went wrong. Cannot create Jira issue.

github-jira-sync-bot commented 2 years ago

:x: Something went wrong. Cannot create Jira issue.

github-jira-sync-bot commented 2 years ago

:x: Something went wrong. Cannot create Jira issue.

github-jira-sync-bot commented 2 years ago

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

m2-assistant[bot] commented 2 years ago

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

engcom-Hotel commented 4 days ago

As the issue is quite old, so tried to reproduce the issue again. The issue seems relevant.

Hence reconfirming the issue.

Thanks

github-jira-sync-bot commented 4 days ago

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-6470