Untitled

mail@pastecode.io avatarunknown
plain_text
a month ago
606 B
1
Indexable
Never
add_filter('b2bking_show_price_offer_backend_product','__return_true');

add_action('b2bking_offer_frontend_before_unit_price', function($product){

	if ($product->is_type('variable')){
		$min_price = $product->get_variation_price( 'min' );
		$max_price = $product->get_variation_price( 'max' );
		$price = wc_format_price_range( $min_price, $max_price );
	} else {
		$price = $product->get_regular_price();
		if (!empty($price)){
			$price = wc_price($price);
		}
	}

	if (!empty($price) && $price !== wc_price(0)){
		echo '<span style="text-decoration: line-through">'.$price.'</span><br>';
	}
}, 10, 1);