How to Display Products Price With TAX & Without TAX in WooCommerce Cart | Individual Product Tax

preview_player
Показать описание
In this woocommerce tutorial for beginners you will learn how to show product prices with taxes and without taxes in cart page using custom php snippet in wordpress website. So after adding custom code you will see single or individual product include tax price and exclude tax price, so in price column you see both prices.

*** Find Custom Code in Top Pinned Comment Section.

#tax #product #cart #price #products #taxes #woocommerce #wordpress #wordpresstutorial #webtaskwithhassan #hassangilani
Рекомендации по теме
Комментарии
Автор

Use this code:

function $price_html, $cart_item, $cart_item_key ) {
// Get the product object
$product = $cart_item['data'];

// Is a WC product
if ( is_a( $product, 'WC_Product' ) ) {
// Price without VAT
$price_excl_tax = (float) wc_get_price_excluding_tax( $product );

// Price with VAT
$price_incl_tax = (float) wc_get_price_including_tax( $product );

// Edit price html
$price_html = wc_price( $price_excl_tax ) . '<span class="my-class">&nbsp;' . __( 'exclude Tax', 'woocommerce' ) . '</span><br>';
$price_html .= wc_price( $price_incl_tax ) . '<span class="my-class">&nbsp;' . __( 'include Tax', 'woocommerce' ) . '</span>';
}

return $price_html;
}
add_filter( 'woocommerce_cart_item_price', 'filter_woocommerce_cart_item_price_tax', 10, 3 );

WebTaskWithHassan