Skip to content

Instantly share code, notes, and snippets.

@wpflames
Created February 25, 2022 15:26
Show Gist options
  • Select an option

  • Save wpflames/23083ee937cb014703072094531d0cfa to your computer and use it in GitHub Desktop.

Select an option

Save wpflames/23083ee937cb014703072094531d0cfa to your computer and use it in GitHub Desktop.
Display Product Price with VAT in Single Product WooCommerce
<?php
// =========================================================================
// DISPLAY PRODUCT PRICE WITH VAT
// =========================================================================
function display_product_price_with_vat(){
global $product;
$brutto_ar = wc_get_price_to_display( $product );
$netto_ar = $brutto_ar/127*100;
$netto_ar_rounded = round($netto_ar);
$netto_ar_plus_afa = $netto_ar_rounded .' Ft + 27% áfa';
echo '<div class="afa">'.$netto_ar_plus_afa.'</div>';
}
add_action('woocommerce_single_product_summary', 'display_product_price_with_vat');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment