Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mbs1337

    (@mbs1337)

    This link gave me some hope, but it returns in a bunch of errors, and then the sidebar does not work.

    https://wordpress.stackexchange.com/questions/106355/how-to-display-price-including-tax-with-formatting

    Thread Starter mbs1337

    (@mbs1337)

    Okay. With the help on Facebook i got it fixed with:

    <p itemprop=”price” class=”priceex”><?php echo number_format( $product->get_price_excluding_tax(), 0, ‘,’, ‘.’ ); ?> kr (excl. moms)</p>

    in

    /plugins/woocommerce/templates/single-product/price.php

    Thread Starter mbs1337

    (@mbs1337)

    Sorry for fast answer. Here is a fix for:

    1) Only comma separator when needed
    2) The last message (without tax) only to be displayed on products with price
    3) When a straight price, the comma separator is gone

    <p itemprop="price" class="priceex">
    <?php 
    
    if (strlen($product->get_price_html()) > 0) {
        if (fmod($product->get_price_excluding_tax(), 1) == 0) {
            echo number_format( $product->get_price_excluding_tax(), 0, '.', '.' );
        }
        else {
            echo number_format( $product->get_price_excluding_tax(), 2, '.', '.' );
        }
        echo ' kr (excl. moms)';
    }
    ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    excl. moms is Danish for “no tax” ??

    Regards from Denmark
    Michael Bay

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pricing separator (tax comma)’ is closed to new replies.