Untitled
unknown
plain_text
a year ago
1.7 kB
2
Indexable
add_filter('b2bking_both_prices_retail_adjust_tax','__return_true'); add_filter('b2bking_filter_wholesale_price_final', function($price, $retail_text, $retail_price, $wholesale_text, $wholesale_price, $product_id){ // get difference between current price and regular price. $product = wc_get_product($product_id); $current_price = b2bking()->b2bking_wc_get_price_to_display( $product, array( 'price' => $product->get_regular_price() )); if ($product->is_on_sale()){ $current_price = b2bking()->b2bking_wc_get_price_to_display( $product, array( 'price' => $product->get_sale_price())); } $retail_price = b2bking()->get_woocs_price(b2bking()->tofloat(get_post_meta($product_id,'_regular_price', true))); $retail_price = b2bking()->b2bking_wc_get_price_to_display( $product, array( 'price' => $retail_price )); $difference = $retail_price - $current_price; $text = '<br><p style="font-size:12px">You are saving '.wc_price($difference).'</p>'; $price = '<span class="b2bking_both_prices_price b2bking_retail_price_price">'. wc_price($retail_price) . '<br></span><span class="b2bking_both_prices_text b2bking_b2b_price_text">'.$wholesale_text.'</span><span class="b2bking_both_prices_price b2bking_b2b_price_price b2bking_b2b_price_id_'.esc_attr($product_id).'">'.$wholesale_price.' exc gst</span>'.$text; return $price; }, 10, 6); add_action('wp_head', function(){ ?> <style type="text/css"> .b2bking_both_prices_price del { display: none !important; } span.b2bking_both_prices_text.b2bking_retail_price_text { display: none; } span.b2bking_both_prices_price.b2bking_retail_price_price { text-decoration: line-through; } </style> <?php });
Editor is loading...
Leave a Comment