Woocommerce: Aplicando impuestos / IVA solo en la página de producto de WooCommerce

function edit_price_display($price, $instance) {
    global $product;

    if(is_singular('product')) {
        $price = $product->price;
        $price_incl_tax = $price + round($price * ( 21 / 100 ), 2);
        $price_incl_tax = number_format($price_incl_tax, 2, ",", ".");
        $price = number_format($price, 2, ",", ".");
        $display_price = '<span class="price">';
        $display_price .= '<span class="amount">€ ' . $price_incl_tax .'<small class="woocommerce-price-suffix"> incl BTW</small></span>';
        $display_price .= '<br>';
        $display_price .= '<span class="amount">€ ' . $price .'<small class="woocommerce-price-suffix"> excl BTW</small></span>';
        $display_price .= '</span>';
        echo $display_price;
    } else {
        echo $price;	
    }
}
add_filter('woocommerce_get_price_html', 'edit_price_display', 10, 2);

Visto en tomjesch

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Scroll al inicio

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.