Код: Выделить всё
function hide_strikethrough_price($price, $product) {
if (is_admin() || !is_shop() && !is_product() && !is_product_category()) {
return $price;
}
if ($product->is_on_sale() && $product->get_regular_price() !== $product->get_price()) {
return wc_price($product->get_sale_price());
}
return $price;
< /code>
} < /p>
if( !function_exists("add_custom_text_prices") ) {
function add_custom_text_prices( $price, $product ) {
// Text
$text_regular_price = __("Non-members: ");
$text_final_price = __("Members only: ");
if ( $product->is_on_sale() ) {
$has_sale_text = array(
'' => '' . $text_regular_price,
'' => '
'.$text_final_price.''
);
$return_string = str_replace(
array_keys( $has_sale_text ),
array_values( $has_sale_text ),
$price
);
return $return_string;
}
return $text_regular_price . $price;
}
add_filter( 'woocommerce_get_price_html', 'add_custom_text_prices', 100, 2 );
Подробнее здесь: https://stackoverflow.com/questions/796 ... t-to-price