Show Free Price instead of 0
-
Hi…
I’ve already added some custom texts to regular and sale prices using the css
::after
element and once I add the filter (at the bottom of this post) to show “Free” instead of zero price it also displays the price text right after the “Free” text. for example if the text for the regular price is “Dollar” then it displays “Free Dollar”. is it possible to remove the::after
element for the code below so that it can only show “Free”?add_filter( 'woocommerce_get_price_html', 'wpglorify_price_free_zero_empty', 100, 2 );
function wpglorify_price_free_zero_empty( $price, $product ){
if ( '' === $product->get_price() || 0 == $product->get_price() ) {
$price = 'Free';
}return $price;
}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Show Free Price instead of 0’ is closed to new replies.