Home › Forums › WoodMart support forum › Hide “to” price not working
Hide “to” price not working
- This topic has 7 replies, 2 voices, and was last updated 1 year, 6 months ago by Luke Nielsen.
-
AuthorPosts
-
July 19, 2023 at 4:32 pm #482683
musabParticipantHi, I want to hide “to price” on the product page, I enabled the option: Hide “to” price in: Theme Settings > Shop > Variable Product, but the “from to Price” still appears on the product page.
July 19, 2023 at 5:09 pm #482696
Luke NielsenKeymasterHello,
Make sure that you have cleared the cache after making changes in Theme Settings. If after the clearing cache, you have the same issue, please send me access to the admin dashboard so I will investigate the issue on your side.
Kind Regards
July 19, 2023 at 5:12 pm #482697
musabParticipantI cleared the cash, re-imported the demo, tried “default Settings”nothing works.
July 19, 2023 at 5:23 pm #482699
Luke NielsenKeymasterHello,
Seems that the “WOOCS” plugin affects a little bit the HTML structure of the price so as a result the CSS code is not working. Could you please disable it, clear the cache and recheck the issue?
Kind Regards
July 19, 2023 at 5:27 pm #482700
musabParticipantafter disabling it, the Hide “to” price function worked, but the plugin is necessary to me as I’m using a Flutter app for my website, it’s needed for the currency switcher. is there any solution :)?
July 19, 2023 at 6:10 pm #482715
musabParticipantHi, solved it by adding this code to my functions.php of my child theme:
//Hide Price Range for WooCommerce Variable Products
add_filter( ‘woocommerce_variable_sale_price_html’,
‘lw_variable_product_price’, 10, 2 );
add_filter( ‘woocommerce_variable_price_html’,
‘lw_variable_product_price’, 10, 2 );function lw_variable_product_price( $v_price, $v_product ) {
// Product Price
$prod_prices = array( $v_product->get_variation_price( ‘min’, true ),
$v_product->get_variation_price( ‘max’, true ) );
$prod_price = $prod_prices[0]!==$prod_prices[1] ? sprintf(__(‘%1$s’, ‘woocommerce’),
wc_price( $prod_prices[0] ) ) : wc_price( $prod_prices[0] );// Regular Price
$regular_prices = array( $v_product->get_variation_regular_price( ‘min’, true ),
$v_product->get_variation_regular_price( ‘max’, true ) );
sort( $regular_prices );if ( $prod_price !== $regular_price ) {
$prod_price = ‘‘.$regular_price.$v_product->get_price_suffix() . ‘‘ .
$prod_price . $v_product->get_price_suffix() . ‘‘;
}
return $prod_price;
}July 19, 2023 at 6:12 pm #482716
musabParticipantlite code:
add_filter( ‘woocommerce_variable_sale_price_html’, ‘lw_variable_product_price’, 10, 2 );
add_filter( ‘woocommerce_variable_price_html’, ‘lw_variable_product_price’, 10, 2 );function lw_variable_product_price( $v_price, $v_product ) {
// Product Price
$prod_price = wc_price( $v_product->get_variation_price( ‘min’, true ) );// Regular Price
$regular_price = wc_price( $v_product->get_variation_regular_price( ‘min’, true ) );if ( $prod_price !== $regular_price ) {
$prod_price = ‘‘ . $regular_price . $v_product->get_price_suffix() . ‘‘ .
$prod_price . $v_product->get_price_suffix() . ‘‘;
}return $prod_price;
}July 20, 2023 at 9:12 am #482825
Luke NielsenKeymasterHello,
Great! I am glad that you have sorted it out.
Always remember that you can reach out to us with any questions you may have.
We wish you a splendid day!
Kind Regards
-
AuthorPosts
Tagged: Hide "to" price
The topic ‘Hide “to” price not working’ is closed to new replies.
- You must be logged in to create new topics. Login / Register