Im facing the same issue,
when i place the code on the functions.php it works, but is not working when i place it on the plugin.
The code is:
add_filter( ‘woocommerce_get_price_html’, ‘price_free_zero’, 9999, 2 );
function price_free_zero( $price, $product ) {
if ( $product->is_type( ‘variable’ ) ) {
$prices = $product->get_variation_prices( true );
$min_price = current( $prices[‘price’] );
if ( 0 == $min_price ) {
$max_price = end( $prices[‘price’] );
$min_reg_price = current( $prices[‘regular_price’] );
$max_reg_price = end( $prices[‘regular_price’] );
if ( $min_price !== $max_price ) {
$price = wc_format_price_range( ‘<span class=”amount”>’ . do_shortcode( ‘[contact-form-7 id=”19909″ title=”Formulario de precios”]’ ) . ‘</span>’, $max_price );
$price .= $product->get_price_suffix();
} elseif ( $product->is_on_sale() && $min_reg_price === $max_reg_price ) {
$price = wc_format_sale_price( wc_price( $max_reg_price ), ‘<span class=”amount”>’ . do_shortcode( ‘[contact-form-7 id=”19909″ title=”Formulario de precios”]’ ) . ‘</span>’ );
$price .= $product->get_price_suffix();
} else {
$price = ‘<span class=”amount”>’ . do_shortcode( ‘[contact-form-7 id=”19909″ title=”Formulario de precios”]’ ) . ‘</span>’;
}
}
} elseif ( 0 == $product->get_price() ) {
$price = ‘<span class=”amount”>’ . do_shortcode( ‘[contact-form-7 id=”19909″ title=”Formulario de precios”]’ ) . ‘</span>’;
}
return $price;
}
-
This reply was modified 2 years, 6 months ago by Oscar.
-
This reply was modified 2 years, 6 months ago by Oscar.
-
This reply was modified 2 years, 6 months ago by Oscar.