• Resolved Jackie Chan

    (@jackie-chan)


    Hi,

    I’m using WooCommerce on my website; for the product pages i used to have a breakdown of the price which showed the price +vat and excluding VAT. I think the code has changed since an update which has reverted the price back to the default display (Price +VAT)

    Below is the code i was using could anyone let me know what i need to update?

    <?php
    /**
     * Single Product Price
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/single-product/price.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you
     * (the theme developer) will need to copy the new files to your theme to
     * maintain compatibility. We try to do this as little as possible, but it does
     * happen. When this occurs the version of the template file will be bumped and
     * the readme will list any important changes.
     *
     * @see     https://docs.woocommerce.com/document/template-structure/
     * @package WooCommerce/Templates
     * @version 3.0.0
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    
    global $product;
    
    if ( $product->get_price_html() ) :
        // Get the prices
        $price_excl_tax = wc_get_price_excluding_tax( $product ); // price without VAT
        $price_incl_tax = wc_get_price_including_tax( $product );  // price with VAT
        $tax_amount     = $price_incl_tax - $price_excl_tax; // VAT amount
    
        // Display the prices
        ?>
        <span class="price price-excl"><?php echo wc_price( $price_excl_tax ); ?></span><br>
        <span class="price tax-price">+ VAT = <?php  echo wc_price( $tax_amount ); ?></span><br>
        <span class="price price-incl">Total = <?php echo wc_price( $price_incl_tax ); ?></span>
    <?php endif ?>

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the following places for more development-oriented questions:

    1. WooCommerce Slack Community: https://woocommerce.com/community-slack/
    2. Advanced WooCommerce group on Facebook: https://www.facebook.com/groups/advanced.woocommerce/
    Thread Starter Jackie Chan

    (@jackie-chan)

    Thanks for your reply, i think it’s just a basic understanding of the array needed but PHP is slightly beyond my scope; all replies welcome ??

    mother.of.code

    (@imazed)

    The Mother of Code

    Hey there @jackie-chan – since there have been no further community replies, I recommend going with the suggestions @riaanknoetze provided. You will get more answers on those platforms.

    I’m going to set this topic to ‘resolved’, but do feel free to open up a new one if you need more help. We’d also welcome an update on this thread with any solution you find.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Woocommerce Price (Changes sinces update)’ is closed to new replies.