Fix for displaying a negative price for a custom option. #14975
Fix for displaying a negative price for a custom option. #14975magento-engcom-team merged 1 commit intomagento:2.3-developfrom dverkade:2.3-Fix-negative-value-for-custom-option
Conversation
…negative price is displayed as +- 5.00 for instance. By changing the template to check of the value is actually positive a negative value will be displayed as - 5.00 and a positive value will be displayed as + 5.00
|
Let's ask the UX team. @DMMundle can you help here? |
|
@dverkade I'm a UX designer at Magento. Happy to review and help here but need some more info.
|
|
@magento-engcom-team give me test instance |
|
Hi @miguelbalparda. Thank you for your request. I'm working on Magento instance for you |
|
Hi @miguelbalparda, here is your Magento instance. |
|
@soumya-ashok can you give it a try in our test instance? |
|
@miguelbalparda The link redirects me to a PR deployment page, and not the Admin view. Am I doing something wrong? |
|
@soumya-ashok & @miguelbalparda here is some additional information you requested and sorry I couldn't respond sooner. What version of Magento is this occurring on for you? I'm on a 2.2.2 test instance and it throws an error on the Admin side when I enter a negative value under Customizable Option. This customer is currently on Magento 2.1.9 (production) upgrade to 2.2.3 is in progress and has the same result. In Magento 1 custom options could be set to a negative value. This is no longer possible in Magento 2 to enter a negative amount in the admin, although Magento itself works fine by doing so. Only the validation in the admin is limiting this behaviour. There is already an issue for this: #7333 Since this behaviour is not fixed at the moment. The price change for the custom option has been changed in the database to the negative amount. I will create another PR for fixing this issue in de backend of Magento. What type of product is this - configurable or grouped Or simple with custom options? It's a simple product with custom options. Could you share a screenshot of the whole screen instead of just the dropdown so we can see where this is happening exactly? Here is the link to the production environment for a product with a negative amount as a custom option. |
|
@dverkade Thanks for the additional information. I am able to see the +- in the link you shared. Just so I understand - it is currently only negative price values that show up with the +- , correct? |
|
Correct, only the negative price values show up with the "+-". This PR changes that behaviour. I have included a complete list of scenario's of a positive value, a negative value and no value with the current and the new situation with this PR. Custom price option of: 5,51 Custom price option of: 0,00 Custom price option of: -5,51 |
|
@dverkade Thanks for the explanation. Will review and get back to you! |
|
@dverkade @miguelbalparda The fix seems fine from a UX perspective. Please do collect any feedback from the merchant once the fix is implemented. Thanks! |
|
Hi @miguelbalparda, thank you for the review. |
|
Hi @dverkade. Thank you for your contribution. |


Fix for displaying a negative price for a custom option.
Description
Currently a negative price is displayed as +-€ 5,51 for instance. By changing the template to check of the value is actually positive, a negative value will be displayed as -€ 5,51 and a positive value will be displayed as +€ 5,51. When the value is exactly 0 nothing will be displayed after the label.
Screenshot displaying the current situation.
Manual testing scenarios