Disable Price range
I have a product like this :
[Links visible only for registered users]
I want always to show the current price, not the price range, i search on internet for a snippet like this:
but doesnt work why?
//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(__('From: %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 );
$regular_price = $regular_prices[0]!==$regular_prices[1] ? sprintf(__('From: %1$s','woocommerce')
, wc_price( $regular_prices[0] ) ) : wc_price( $regular_prices[0] );
if ( $prod_price !== $regular_price ) {
$prod_price = '<del>'.$regular_price.$v_product->get_price_suffix() . '</del> <ins>' .
$prod_price . $v_product->get_price_suffix() . '</ins>';
}
return $prod_price;
}
Comments
I dont want that extra fields [Links visible only for registered users]
i want only one field and when i change variable then change the price instantly. That confusing the customers
Hi,
You can use the following CSS code:
.single-product .entry-summary p.price{ display: none!important; }Put it in Betheme -> Theme options -> Custom CSS & JS -> CSS.
Thanks
Nice but with hide , when the product is simple product doesnt show the prices because we hide it
[Links visible only for registered users]
Also i want the price to go above above color variation as it was the main price,
[Links visible only for registered users]
also on product catalog appears [Links visible only for registered users]
Why the code that i type doesnt work?
What you ask for requires file customization which in reference to Item Support Policy is not allowed. [Links visible only for registered users]
So if you want to modify files and don't know how, you should contact your web developer. Item Policy says:
Item support does not include services to modify or extend the item beyond the original features, style, and functionality described on the item page. For customization services that will help you tailor the item to your specific requirements, we recommend contacting the author to see if they privately offer paid customization services or checking out the great service providers on Envato Studio.
Thanks