This topic has 12 replies, 3 voices, and was last updated 8 years, 3 months ago ago by Olga Barlow
The sales-badge and regular price disappears when i’m using this piece of code in my functions.php file. I have tried ith with other themes and it seems to work, but not with Xstore
add_filter( 'woocommerce_get_price_excluding_tax', 'round_price_product', 10, 1 );
add_filter( 'woocommerce_get_price_including_tax', 'round_price_product', 10, 1 );
add_filter( 'woocommerce_tax_round', 'round_price_product', 10, 1);
add_filter( 'woocommerce_get_price', 'round_price_product', 10, 1);
function round_price_product( $price ){
Return rounded price
return round( $price );
}
The reason i want to use this code is that many transaction services (PayEx, Stripe.. etc) gives error on prices with 3 desimals. So when I i.e. run “whole store sale for 15%” some prices are automacally calculated to 3 desimals, like “145.612”. I want to round this price to “145.00” to avoid any issues with the creditcard service.
Anyone know any solution?
Hello,
Thank you for using our theme.
We don’t see our XStore theme installed on the web-site you send us. Could you please provide a link to the page where we can see this problem? And give us your admin access also.
Regards
the website that use the license is uteutstyr.no. The website is closed at the moment behind a “coming soon” page. I have included logininfo in private content
Yes, we see the problem. Where did you place this piece of code? In our child theme for Xstore? How did you test it with our theme, did you place this code to their functions.php files also? If yes so provide us your FTP access and we will see why it is happening only with our theme.
yes, I just paste this code in to the functions.php file of the child-theme. I have tested it on the main xstore-theme as well, but same issue there.
Cant you just use the edit-page in the WP-dashboard to see file contents?
But this problem is not caused by our theme in this case, right? Most likely that your custom PHP code just break woocommerce pricing functionality.
The problem is most likely caused by your theme, because it works on all other themes i’ve tested.
So, my dilemma is that I really want to use your theme but I cant without getting this litte code to work 🙂 I need help to figure out why this code-snippet doesnt work with your theme because i need to use it. Hope you can help
Okay, so please provide us your FTP access so we could test how it works on other themes and why doesn’t work with XStore. We are not able to do it via dashboard editor.
ok, no problem. I added it in the private section of the post
We tried to add this code to the twentyfifteen theme and it produces the same problem https://gyazo.com/00409fe9d83d9508cb548ba54388b217
It means that this code breaks woocommerce sale price and not our theme.
ok, thanks for checking, but any chance you have a code I could use to round prices, without error?
Hello,
Number of decimals you can set in WooCommerce settings http://prntscr.com/cdcvm9
All the other methods required additional customization and we are sorry but it’s not included in our support.
Regards
Tagged: customize, display, salesbadge, themes, woocommerce, wordpress
You must be logged in to reply to this topic.Log in/Sign up