Price manipulation provided code problem different currencies
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from gabriel.pribeagu on October 1, 2021, 12:50Hello
Here is the link to a producct
https://add2.ro/shop/fotoliu-crem-pernutele-textile-malibu-mdv54-dooq/
We insert prices in euro, apply a VAT tax of 19% and display in romanian RON (lei) currency.
Everything ok, see picture https://clip2net.com/s/4dwgsCl
But we need to round the price up to next 10 so we used a snippet from your support exemple to insert the formula to do that.
The problem is that the final displayed romanian price is totaly wrong (looks like euro price).
See picture https://clip2net.com/s/4dwgUg7
What should I modify in snippet to make it work?
Thank you
p.s. in private area you have acces to admin and also to ftp
Hello
Here is the link to a producct
https://add2.ro/shop/fotoliu-crem-pernutele-textile-malibu-mdv54-dooq/
We insert prices in euro, apply a VAT tax of 19% and display in romanian RON (lei) currency.
Everything ok, see picture https://clip2net.com/s/4dwgsCl
But we need to round the price up to next 10 so we used a snippet from your support exemple to insert the formula to do that.
The problem is that the final displayed romanian price is totaly wrong (looks like euro price).
See picture https://clip2net.com/s/4dwgUg7
What should I modify in snippet to make it work?
Thank you
p.s. in private area you have acces to admin and also to ftp
Quote from Pablo Borysenco on October 4, 2021, 09:54Hello
Code customization is not included in support
Please delete your code and read this - https://currency-switcher.com/hook/woocs_raw_woocommerce_price/ and https://currency-switcher.com/hook/woocs_woocommerce_variation_prices/
Your code does not round off prices, your code changes the rate
Hello
Code customization is not included in support
Please delete your code and read this - https://currency-switcher.com/hook/woocs_raw_woocommerce_price/ and https://currency-switcher.com/hook/woocs_woocommerce_variation_prices/
Your code does not round off prices, your code changes the rate
Quote from gabriel.pribeagu on October 4, 2021, 10:31I just don`t know how to round the price that is displayed in another currency... Please help
I have followed the link you sugested above https://currency-switcher.com/hook/woocs_raw_woocommerce_price/
Not working yet..
https://clip2net.com/s/4dxwlOV
the second link you provided is for variable products I suppose (I have only normal products)
I just don`t know how to round the price that is displayed in another currency... Please help
I have followed the link you sugested above https://currency-switcher.com/hook/woocs_raw_woocommerce_price/
Not working yet..
https://clip2net.com/s/4dxwlOV
the second link you provided is for variable products I suppose (I have only normal products)
Quote from Pablo Borysenco on October 4, 2021, 12:57Hello
Please try to paste this code in functions.php
Drop me exact link to the issue
Hello
Please try to paste this code in functions.php
Drop me exact link to the issue
Quote from gabriel.pribeagu on October 4, 2021, 13:41I have also tested with the same code as in the snipet from my picture and I inserted in functions.php.
The exactly same result.
Here is the product link
https://add2.ro/shop/fotoliu-crem-pernutele-textile-malibu-mdv54-dooq/
For the moment I removed the code from functions.php
You have acces to ftp in private area.
Here is the code to test. Thank you
add_filter('woocs_raw_woocommerce_price', function($price) {
if (($price <= 20))
{
$price = round($price / 20, 0) * 20;
return $price;
} else
{
$price = ceil($price / 10) * 10;
return $price;
}
});
I have also tested with the same code as in the snipet from my picture and I inserted in functions.php.
The exactly same result.
Here is the product link
https://add2.ro/shop/fotoliu-crem-pernutele-textile-malibu-mdv54-dooq/
For the moment I removed the code from functions.php
You have acces to ftp in private area.
Here is the code to test. Thank you
add_filter('woocs_raw_woocommerce_price', function($price) {
if (($price <= 20))
{
$price = round($price / 20, 0) * 20;
return $price;
} else
{
$price = ceil($price / 10) * 10;
return $price;
}
});
Quote from Pablo Borysenco on October 5, 2021, 10:20Hello
My test - https://c2n.me/4dykllb.png
the code is in functions.php
Hello
My test - https://c2n.me/4dykllb.png
the code is in functions.php
Quote from gabriel.pribeagu on October 5, 2021, 12:02Hello
It worked :)
Thank you
Hello
It worked :)
Thank you
Quote from gabriel.pribeagu on October 5, 2021, 14:53Sorry, still not working
There rounded price is weird, I meanit is rounded but it is not the correct value. It is too big
the original value was 22253lei and it should become 22260lei (rounded to next ten) but insteed is 22610 (+350lei instead of +7lei))??
https://clip2net.com/s/4dyCIZr
here is the product link Fotoliu crem, pernutele textile, Malibu MDV54 Dooq – Add2
Your code is in functions.php and you have access there
Thank you
Sorry, still not working
There rounded price is weird, I meanit is rounded but it is not the correct value. It is too big
the original value was 22253lei and it should become 22260lei (rounded to next ten) but insteed is 22610 (+350lei instead of +7lei))??
https://clip2net.com/s/4dyCIZr
here is the product link Fotoliu crem, pernutele textile, Malibu MDV54 Dooq – Add2
Your code is in functions.php and you have access there
Thank you
Quote from Pablo Borysenco on October 6, 2021, 09:53Hello
Use code
add_filter('woocs_raw_woocommerce_price', function($price) {
$price = ceil($price / 10) * 10;
return $price;});
Hello
Use code
add_filter('woocs_raw_woocommerce_price', function($price) {
$price = ceil($price / 10) * 10;
return $price;
});
Quote from gabriel.pribeagu on October 6, 2021, 13:37hello, and thank you for helping me
I have inserted the exact code you provided above, still no correct rounded value...
See picture with wrong values https://clip2net.com/s/4dzmyoe
Maybe the $price variabile from the code is not referring to the currency I display? (prices are inserted in euro, then I add a 19% tax, than display in RON currency). The round should be done to RON currency to the next ten.
Your code is in functions.php and you have access there
try to this product if you need a link Fotoliu crem, pernute textile, Coral C311 Paolo Castelli – Add2
Thank you
hello, and thank you for helping me
I have inserted the exact code you provided above, still no correct rounded value...
See picture with wrong values https://clip2net.com/s/4dzmyoe
Maybe the $price variabile from the code is not referring to the currency I display? (prices are inserted in euro, then I add a 19% tax, than display in RON currency). The round should be done to RON currency to the next ten.
Your code is in functions.php and you have access there
try to this product if you need a link Fotoliu crem, pernute textile, Coral C311 Paolo Castelli – Add2
Thank you
Quote from Pablo Borysenco on October 7, 2021, 10:05Hello
Please be careful with the code, if you can't do it correctly, you should hire a developer
Of course it will work like this.
https://c2n.me/4dzYwva.jpg AND https://c2n.me/4dzYyRn.png - Please find the difference in the price format. You change the display settings of cents and say that now it does not work.
you should determine how you will display prices . The number of zeros ( https://share.pluginus.net/image/i20211007110326.png ) determines how many characters to round in the price - https://share.pluginus.net/image/i20211007110438.png and https://c2n.me/4dzZ725.png
Hello
Please be careful with the code, if you can't do it correctly, you should hire a developer
Of course it will work like this.
https://c2n.me/4dzYwva.jpg AND https://c2n.me/4dzYyRn.png - Please find the difference in the price format. You change the display settings of cents and say that now it does not work.
you should determine how you will display prices . The number of zeros ( https://share.pluginus.net/image/i20211007110326.png ) determines how many characters to round in the price - https://share.pluginus.net/image/i20211007110438.png and https://c2n.me/4dzZ725.png
Quote from gabriel.pribeagu on October 7, 2021, 11:00Hello,
I perfectly understand your observation and I`m very good at math :)
I do not want to waste your time, but if you will try to apply your formula you will se that it is just not working in my setup
You told me that I should determine how I will display my prices. Ok. The prices should be in "lei" and should be integers like format (so no decimal part) . Pls take note that in Romania currency, the "comma" has the role of decimal point.
So let take this product where I set the price via woocs setting without decimals https://clip2net.com/s/4dA1KXe
As you see the price is 4452Ron.
we will apply
$price = ceil($price / 10) * 10;
naturally we will expect 4452 to become 4460. Tested in excel :) https://clip2net.com/s/4dA2jUT
But see picture https://clip2net.com/s/4dA21Gd
4452 has become 4463. It make no sense to mee.
Test it for your self in my website pls on this product (link below)
This is the product where to test https://add2.ro/shop/fotoliu-bej-pernute-textile-picioare-metalice-holly-lounge-p065-tirolosedie/
Your code is in functions.php and you have access there
Thank you for your time
Hello,
I perfectly understand your observation and I`m very good at math :)
I do not want to waste your time, but if you will try to apply your formula you will se that it is just not working in my setup
You told me that I should determine how I will display my prices. Ok. The prices should be in"lei" and should be integers like format (so no decimal part) . Pls take note that in Romania currency, the"comma" has the role of decimal point.
So let take this product where I set the price via woocs setting without decimals https://clip2net.com/s/4dA1KXe
As you see the price is 4452Ron.
we will apply
$price = ceil($price / 10) * 10;
naturally we will expect 4452 to become 4460. Tested in excel :) https://clip2net.com/s/4dA2jUT
But see picture https://clip2net.com/s/4dA21Gd
4452 has become 4463. It make no sense to mee.
Test it for your self in my website pls on this product (link below)
This is the product where to test https://add2.ro/shop/fotoliu-bej-pernute-textile-picioare-metalice-holly-lounge-p065-tirolosedie/
Your code is in functions.php and you have access there
Thank you for your time
Quote from Pablo Borysenco on October 7, 2021, 12:46Ok! In this case, use a different code to round prices after taxes have been calculated.
My hook works before taxes, then my plugin does not affect the price
Ok! In this case, use a different code to round prices after taxes have been calculated.
My hook works before taxes, then my plugin does not affect the price
Quote from gabriel.pribeagu on October 7, 2021, 13:20Oh, ok that info I need it, Thank you
So I will write the working code here for others to know how to solve this particular problem when you have taxes like VAT displayed in price.
add_filter('woocs_raw_woocommerce_price', function($price) {
//round to next ten
//$price = ceil($price / 10) * 10);
//but the hook provided is rounding prices before tax so for 19% tax will use this$price = (ceil($price*1.19 / 10) * 10)/1.19;
return $price;});
Thank you
Oh, ok that info I need it, Thank you
So I will write the working code here for others to know how to solve this particular problem when you have taxes like VAT displayed in price.
add_filter('woocs_raw_woocommerce_price', function($price) {
//round to next ten
//$price = ceil($price / 10) * 10);
//but the hook provided is rounding prices before tax so for 19% tax will use this
$price = (ceil($price*1.19 / 10) * 10)/1.19;
return $price;
});
Thank you
Quote from Pablo Borysenco on October 8, 2021, 11:23Hello
Great! Thank you for cooperation
Hello
Great! Thank you for cooperation