Untitled
add_filter('b2bking_dynamic_recalculate_sale_price_display', function($price_html, $product, $sale_price){ if ($product){ if ($product->is_on_sale()){ $price_html = $product->get_sale_price(); //if (floatval($price_html) === floatval(0)){ if ($product->is_type('variable')){ $children = $product->get_children(); $variation = wc_get_product($children[0]); $regprice = $variation->get_regular_price(); $saleprice = $variation->get_sale_price(); if ($regprice !== $saleprice){ if ($saleprice < $regprice){ $price_html = wc_format_sale_price( $regprice, $saleprice) . $product->get_price_suffix($saleprice); } else { $price_html = wc_price($saleprice) . $product->get_price_suffix($saleprice); } } else { $price_html = wc_price($regprice) . $product->get_price_suffix($regprice); } } //} } } return $price_html; }, 11, 3);
Leave a Comment