Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Display the tax rate applicable to a product, on the single product page.
- * Need help customising the code for your need? Hire us on Codeable: https://aelia.co/hire_us
- */
- function exbtw_melding(){
- global $product;
- $price_incl_tax = wc_get_price_including_tax($product);
- $price_excl_tax = wc_get_price_excluding_tax($product);
- if(($price_incl_tax != 0) && ($price_excl_tax != 0)) {
- // Determine the tax rate, with a maximum of two decimals
- $tax_rate = round((($price_incl_tax / $price_excl_tax) - 1) * 100, 2);
- }
- // Display a message with the tax rates
- echo 'Alle vermelde prijzen zijn excl. <b>'. $tax_rate . ' BTW</b> / Tous les prix indiqués sont hors <b> '. $tax_rate . ' TVA</b>';
- }
- add_action( 'woocommerce_before_add_to_cart_form', 'exbtw_melding', 20 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement