Salesbadge not displaying when using - by Mats

This topic has 12 replies, 3 voices, and was last updated 8 years, 3 months ago ago by Olga Barlow

  • Avatar: Mats
    Mats
    Participant
    August 31, 2016 at 17:55

    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?

    11 Answers
    Avatar: 8theme
    8theme
    Support staff
    September 1, 2016 at 09:49

    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

    Avatar: Mats
    Mats
    Participant
    September 1, 2016 at 09:56

    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

    Please, contact administrator
    for this information.
    Avatar: 8theme
    8theme
    Support staff
    September 1, 2016 at 10:31

    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.

    Avatar: Mats
    Mats
    Participant
    September 1, 2016 at 12:20

    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?

    Avatar: 8theme
    8theme
    Support staff
    September 1, 2016 at 12:42

    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.

    Avatar: Mats
    Mats
    Participant
    September 1, 2016 at 12:43

    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

    Avatar: 8theme
    8theme
    Support staff
    September 1, 2016 at 13:47

    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.

    Avatar: Mats
    Mats
    Participant
    September 1, 2016 at 19:47

    ok, no problem. I added it in the private section of the post

    Please, contact administrator
    for this information.
    Avatar: 8theme
    8theme
    Support staff
    September 2, 2016 at 10:00

    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.

    Avatar: Mats
    Mats
    Participant
    September 2, 2016 at 13:07

    ok, thanks for checking, but any chance you have a code I could use to round prices, without error?

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    September 2, 2016 at 16:53

    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

  • Viewing 12 results - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.