magento2
magento2 copied to clipboard
[Bug] REST API: Update special prices does not set values for all store views
Preconditions and environment
- Magento versionL 2.4.7-p3
- Anything else that would help a developer reproduce the bug
Steps to reproduce
- Create multiple websites and storeviews
- Use de REST API to update a special price for a website (any store view ID)
- Verify change, you'll see that only the storeview for the ID you passed is updated and Magento does not override the settings for the other storeviews, these are still on "Use Default Value".
Expected result
Since the special pricing attributes are in website scope, I would expect all store views to be updated, not just the single ID passed in the endpoint.
Actual result
The special price values are only updated for the store view ID that is provided through the payload, all the other storeviews are not synced. I consider this a bug since the default Magento 2 admin handles this automatically. When you change the value for an attribute in the website scope, all other storeviews are also updated. IMO the REST API should behave the same.
Additional information
No response
Release note
This bug enforces anyone using the REST API to provide the special price for ALL storeviews in that website, which is hugely redundant and also enforces an extra REST API call to get these IDs. Special prices are critical data since incorrect values could result in invalidly priced orders. Therefore I set this to S1 severity.
Triage and priority
- [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [X] 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”.
Hi @JoryHogeveen. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.
- 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.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :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.
Hi @engcom-Hotel. 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:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- If the issue is reproducible on2.4-developbranch, 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: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hello @JoryHogeveen,
Thanks for the report and collaboration!
We have tried to reproduce this issue in the latest development branch i.e. 2.4-develop and the issue seem reproducible for us.
Below steps we followed to reproduce the issue:
- Go to Stores -> Configuration -> Catalog -> Catalog -> Price and update
Catalog Price ScopeasWebsite. - Create multiple websites, stores, and storeviews.
- Edit any product, and choose the scope (We chose
Spanish): - Click on
Advanced Pricingand add a special price for the product. - Save the product. This will also update the special price for the
Spanish 2store. - But if we use rest API as below:
http://local.magentoissues.com/rest/all/V1/products/special-price
{
"prices": [
{
"price": 200,
"store_id": 2,
"sku": "product_dynamic_1"
}
]
}
- It is updating only for the mentioned store id. but it should update for all stores under that website.
Hence confirming the issue.
Thanks
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-13671 is successfully created for this GitHub issue.
: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.
is it still a priority? I am interested in solving it
Hi @mapletechno The bug still exists. I've made a workaround by always adding all storeviews in my requests but this is of course not a fix.
@JoryHogeveen I can make a PR to solve it, but I need to know whether it's a priority or not from @engcom-Hotel
Hi @mapletechno why would it matter whether it has priority or not? Any bugfix is an improvement right :)
@JoryHogeveen I am new here and trying to contribute to this community. According to the documentation, bugs are fixed based on their priority and severity.
I would love to work on it upon approval.
Hello @mapletechno,
It's great to hear that you're interested in contributing here! You're always welcome to do so, and no approval is required.
Regarding this particular issue fix, I see from the internal JIRA ticket that it hasn't been picked up by anyone yet internally. So, I think you can go ahead and take it on.
You can go through with this link for more information on code contribution.
Thanks
@engcom-Hotel I deeply appreciate your response. I am happy to work on it.
@magento I'm working on it
If this bug has actually been around for a while it might very well have a significant impact when 'fixed' if people believe this is the way it / the API is supposed to work. I did believe it worked that way simply because of the required store_id parameter, which apparently doesn't make any sense to have in the first place.
@Swahjak while I understand where you are coming from, I do not agree with the statement that users would assume this is the way it should work. Prices simply cannot be in the store view scope and the fact that the API lets you do this is a bug which can result in unintended behavior in Magento core and other plugins.
However, I do agree that a store_id parameter makes no sense. This should be a website_id parameter since that is the only (optional) scope a price can have.
One optional solution is to deprecate the store_id param and introduce a website_id param so users can transition when they can.
is it possible to get a server to reproduce this problem? Thanks.
Hi @mapletechno This bug is already reproduced and can be reproduced on any installation, no specific config needed. The question is now, how to solve it. I personally think that by introducing a website_id field to this endpoint and deprecating the store_id allows users to switch in the coming versions whilst maintaining backwards compatibility for now.
Hi @JoryHogeveen,
Adobe Commerce Engineering team started working on this issue. We will reach out to you if we need more information and you will get notified once the issue is fixed. Please leave comments for any further questions.
Thank you!
Hello,
As I can see this issue got fixed in the scope of the internal Jira ticket AC-13671 by the internal team Related commits: https://github.com/search?q=repo%3Amagento%2Fmagento2+AC-13671&type=commits
Based on the Jira ticket, the target version is 2.4.9-alpha2.
Thanks