Hello, I want to show both original price and discounted price without VAT if there is a discount (which there will always be for B2B users). I am using the following code but it doesn't work with the discounts made by B2BKing. Is there a way to make it work (preferrably with dynamic discount rules as I don't like updating prices for products separately).
Below is the snippet I'm using and I attached couple pictures of how iI want it to work also with dynamic discounts. Note that this is required only for B2B users. For Logged out / B2C users I want to show only regular or sale price (input in normal woocommerce regular/sale price field, depending if there is a sale ongoing or not).
I understand that customization is not included in support but I hope you can point me to right direction (I'm still learning modifying instead of adding plugins) or give me a quote of such modification. Thank you!
//Määrittelee miten myyntihinta näytetään
function edit_price_display() { global $product; $price = $product->price; $price_excl_tax = round($price / ( 1.24 ), 2); $price = number_format($price, 2, ",", "."); $display_price = '<span class="price">'; $display_price .= '<span class="amount"> Myyntierä ' . $price .'<small class="woocommerce-price-suffix">€ Sis ALV</small></span>'; $display_price .= '<br>'; echo $display_price;
} add_filter( 'woocommerce_get_price_html', 'edit_price_display', 10, 2 );
//Määrittelee hinta ja alv 0% arvon ja näyttää molemmat
function ts_custom_price() {
global $product;
$price = $product->price;
$price_excl_tax = round($price / ( 1.24 ), 2);
if ($product->is_on_sale())
{
if( $product->is_type('simple') || $product->is_type('external') || $product->is_type('grouped') ) {
$regular_price = get_post_meta( $product->get_id(), '_regular_price', true );
$sale_price = get_post_meta( $product->get_id(), '_sale_price', true );
if( !empty($sale_price) ) {
print '<p class="custom_text"><b>OVH:</b> €'.$regular_price.'</p><p class="custom_text"><b>ALV 0%:</b> €'.$price_excl_tax.'</p>';
}
}
}
}
add_filter( 'woocommerce_get_price_html', 'ts_custom_price', 10, 2 );


