Description
Preconditions (*)
- Magento 2.4.2
- Atleast 2 store views
- 1 product which is assigned to atleast 2 store views
- Price scope is set to global
Steps to reproduce (*)
- Set price scope to website in app/etc/config.php
- Initial:
'price' => [
'scope' => null,
],
- New:
'price' => [
'scope' => 1,
],
- Execute
bin/magento app:config:import
- Clean magento cache
bin/magento cache:clean
Expected result (*)
- When I now save different product prices for each website it should save the values for each website
Actual result (*)
- The price only gets saved for the Default website
Solution
The underlying problem is that in the table catalog_eav_attribute
the value for is_global
is '1' (= global scope) for the price attribute if you set the price scope to website via the config.php. This leads to \Magento\Catalog\Model\Product\Attribute\Backend\Price::Magento\Catalog\Model\Product\Attribute\Backend::afterSave() not saving the price for each store as it thinks price is a global attribute.
When changing the price scope to website via adminhtml (as seen in the DevDocs the column is_global
in the table catalog_eav_attribute
is set to '2' (=website scope) for the price attribute and everything works as supposed.
So the solution would be to set the is_global
column in the table catalog_eav_attribute
to '2' or '1' for the price attribute when changing the price scope via the config.php file.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
The Severity is S1 as now I have to goto every database we have and set the value is_global
in the table catalog_eav_attribute
to '2' for the price attribute, which is something I definitly don't want to do in production environments. I cannot set the price scope via adminhtml as it's blocked as the config value is present in the config.php. So there is a workaround for this but it's wonky as hell.
Activity
m2-assistant commentedon Jul 22, 2021
Hi @oneserv-heuser. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
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 releaseFor more details, please, review the Magento Contributor Assistant documentation.
Please, add a comment to assign the issue:
@magento I am working on this
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
t-heuser commentedon Jul 22, 2021
I can confirm that this issue also exists on a vanilla magento instance.
mrtuvn commentedon Jul 23, 2021
just curiously have you import correct price scope ? Would be great if you can share file config.php in description
['system']['default']['catalog']['price']['scope']
t-heuser commentedon Jul 23, 2021
@mrtuvn What exactly do you mean? Yes, the value I've changed has the path ['system']['default']['catalog']['price']['scope']. Before the value was null and now it's 1. 1 is also the value which the option in the select for the configuration of the price scope has.
m2-assistant commentedon Jul 29, 2021
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: 👇
1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until labelIssue: 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
branchDetails
- 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 labelReproduced 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-November commentedon Aug 2, 2021
Verified the issue on Magento2.4-develop branch and the issue is reproducible:
Steps to reproduce:
Issue: User is able to save the product but price is not getting changed. Default Price is displayed.
User is able to save different price only when scope is set to "All Store Views"
For Scope "Default Store View" and "New Store View" - New Price saved is not getting updated.
magento-engcom-team commentedon Aug 2, 2021
✅ Confirmed by @engcom-November
Thank you for verifying the issue. Based on the provided information internal tickets
MC-42963
were createdIssue 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.
34 remaining items