Custom options save wrong price values after editing
Magento CE 2.1.0 using USD as currency.
When product custom options are saved with prices > $999, revisiting the product page will display the "Price" field for custom options using commas to separate thousands (ie 1,500.00 or 1,000.00).
When saving prices with these default values, the first comma is used as the decimal point. Saving 1,000.00 in a custom options field will store 1.00 in the database.
Steps to reproduce
- Create a product and add a custom option price greater than or equal to 1000
- Save the product and go to its edit page again.
- The new value of the custom option price will 1,000.0
- Without changing this value, save the product.
- The new value for the custom option price will be 1.00
Expected result
Magento should handle custom option prices on product edit pages as it does for regular product prices.
Hi @AirmanAJK , thanks for reporting this issue. We've created internal ticket MAGETWO-57639.
Best, Anton.
Can confirm this issue also exists using $AUD as currency also. Also not sure if it's related but even if choosing percentage as the option, the value still displays as currency.
This issue also exits with đ - Vietnam dong..
Confirmed still an issue in CE 2.1.3
For USD price formatting in the administration back end, there is really no need for a comma in the price (which seems to improperly attribute a decimal to your value on product save). My temporary fix is to just stop reporting prices with the comma with:
\vendor\magento\module-catalog\Ui\DataProvider\Product\Form\Modifier\CustomOptions.php
protected function formatPrice($value)
{
if (!is_numeric($value)) {
return null;
}
$store = $this->storeManager->getStore();
$currency = $this->getLocaleCurrency()->getCurrency($store->getBaseCurrencyCode());
$value = $currency->toCurrency($value, ['display' => \Magento\Framework\Currency::NO_SYMBOL]);
// Remove comma from value:
$value = str_replace(",","",$value);
return $value;
}
I've yet to learn how to override in a much more proper way and for this I apologize.
Hi WaterSlide. To address the right way to fix this, normally you would want to create an "after" plugin in your own extension to just update the value after the function is called, but since this formatPrice() function is protected, you either need to apply the plugin to another function in the call stack, or extend the class and force you inherited version to be injected using the di.xml configuration. The latter is a bit more invasive as it replaces the entire class with yours, which is why a plugin is typically preferred for these kinds of small changes.
I'm using current version 2.1.3 but has this problem wrong price for all those products which have customize options in all currencies other than base currency for example attached product has price 43,065 PKR but show in millions

This Bug is still open since month. And I can confirm that it still exists in 2.1.5. When will you remedy that problem.
This patch seems to work fine in magento 2.1.5:
https://github.com/magento/magento2/commit/496c24d58a0624a865c78b5da63f138bd279ea01
But why it isn't still integrated in one of the latest magento versions 2.1.3, 2.1.4 or 2.1.5. ???
Still its not working in 2.1.5. Totally wrong prices when currency switching. its fine in default currency.
Internal ticket for ver. 2.1 - MAGETWO-58571. The issue has been already fixed and will be available in one of the nearest releases.
@AirmanAJK, thank you for your report. The issue is already fixed in 2.2.0
i have same issue like that. when i have update product price rs50000 and save, after some time it show the value like rs50 in backend and frontend in magento 2 version 2.1.8. kindly resolved it asap.price change automatically.fully frustrated guys help me.
I have also same issue . When i have update product price 1.000,00 which is converted into 1 Kindly update mY version is 2.1.7