- Do you want to hide the price of all the WooCommerce variable products listed in your online store? The information mentioned below will help you do that.
Suppose, a customer is surfing your WooCommerce store for a red colored hoody. However, they come across two different price tags for the same product due to the available color. This situation arises when you as the online store owner add what is known as a WooCommerce variable products. So, if you do not want to turn away the customer solely on the basis of price, you should hide the price range and make it visible when the customer selects that particular variation.
The question is – How do you do that? Now
It is the easiest method to hide the price range for a WooCommerce variable product listing. All you need to do is download the Variation Price Display Range for WooCommerce plugin. Here’s how you can do it.
That’s not all! You also need to configure the plugin correctly to get the desired result. Here’s how you can do that.
Let’s now check out the second method.
For this method, you will have utilize the Code Snippets plugin to hide the price range for the variable product.
//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 );
Code FIELD
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;
}
You can hide the price range for WooCommerce variable product from your online store without using any plugins or coding. This method will help you do that.
Note: If you are doing this process for the first time, a warning message will pop-up stating that editing the theme file can break the website and it is not recommended.
Now, there are some sellers who might not agree with the idea of hiding the price of a product. However, it does offer two major benefits including:
If your online store has too many WooCommerce variable product listing, you can use any of the methods described above to hide the price. Doing this can also help increase traffic to your online store as customers would have to click on the product page to know more about it, including the price.
Also, if you are finding it hard to add a payment method for your WooCommerce store, do check out our guide on How to Add Payment Method in WooCommerce store.
Responsive design means a design that fits all screen display sizes. The truth is that…
Shopify, the e-commerce giant, has revolutionized the way businesses operate online. From small startups to…
Are you bothered by Shopify variant images not working issue? Check this how-to guide and…
eCommerce alcohol sales in 16 markets are expected to increase by over a third, reaching…
Google Search Console to discontinue Product Results Report Feature. Get the latest updates on changes…
Why Shopify is bad for eCommerce’! Shopify is used by thousands of businesses worldwide, but…