Awesome q2a theme

How do I output the sign if the price is equal to 0 Woocommerce?

0 like 0 dislike
26 views
Hi all. There is such a need in the Woocommerce shop, when the price is zero, that is, free goods, output its label. Doing such action
filter_woocommerce_empty_price_html function($price, $_product) { if ($_product->get_price() == 0) return __('Price check'); return $price; } add_filter( 'woocommerce_empty_price_html', 'filter_woocommerce_empty_price_html', 10, 2 );

but it works when prices do not, and such a product in the basket is not put. Already a head broke in 2 days. Who can tell me what I'm doing wrong.
by | 26 views

1 Answer

0 like 0 dislike
Helped to solve so
add_filter( 'woocommerce_get_price_html', 'product_price_free_zero_empty', 100, 2 ); product_price_free_zero_empty function( $price, $product ){ if ( " === $product->get_price() || 0 == $product->get_price() ) { $price = 'Price check'; } return $price; }
by
110,608 questions
257,187 answers
0 comments
40,796 users