WooCommerce - excelling eCommerce
[resolved] Pricing separator (tax comma) (4 posts)

  1. mbs1337
    Posted 2 years ago #

    Hello there.

    Is it possible to add a comma to the tax pricing on a product page?

    See this: http://tkmaskiner.dk/produkt/foton-824/

    The price:

    kr188000 (excl. moms)

    I want:

    kr188.000 (excl. moms)

    For the tax price i put this in price.php:

    <p itemprop="price" class="priceex">kr<?php echo $product->get_price_excluding_tax(); ?> (excl. moms)</p>

    Thanks in advance!

    Regards Michael


  2. mbs1337
    Posted 2 years ago #

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


  3. mbs1337
    Posted 2 years ago #

    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>



  4. mbs1337
    Posted 2 years ago #

    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">
    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic