GET A QUOTE
Md Asik QR Code

Hiding Price Range in WooCommerce Single Product Page – 2024 Step-by-Step Guide

HIDING PRICE RANGE IN WOOCOMMERCE SINGLE PRODUCT PAGE

In the hectic world of e-commerce, presentation is paramount. Every detail on your WooCommerce product pages can influence a customer’s decision, including price. However, there are instances where you may want to hide a price range, especially for variable products or specific product categories. In this guide, we’ll tell you how to hide a price range using PHP snippets in your WordPress theme’s functions.php file.

Table of Contents

When it comes to WooCommerce, customization is key. Sometimes, you may need to hide a price range on your product pages. Be it variable products or all product types, this can be effortlessly achieved with a few lines of code. Below, we’ll explore three methods using PHP snippets and explain each step in detail.

Method 1: Removing price variation below the heading for variable products

For variable products, displaying a price range is not always desirable. To remove a price variation below the header on a single product page, follow these steps:

				
					add_action( 'woocommerce_before_single_product', 'my_remove_variation_price' );
function my_remove_variation_price() {
  global $product;
  if ( $product->is_type( 'variable' ) ) {
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price' );
  }
}

				
			

Explanation:

  • We’re using the add_action hook to execute a function before the single product page is displayed.
  • Inside the function my_remove_variation_price(), we’re checking if the product type is variable using $product->is_type( 'variable' ).
  • If it’s a variable product, we remove the action responsible for displaying the price using remove_action.

Method 2: Removing Price Below Title for Simple Products

For simple products, you might prefer to hide the price altogether. Here’s how you can achieve that:

				
					add_action( 'woocommerce_before_single_product', 'my_remove_simple_price' );
function my_remove_simple_price() {
  global $product;
  if ( $product->is_type( 'simple' ) ) {
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price' );
  }
}

				
			

Explanation:

  • Similar to the previous method, we’re using the add_action hook to execute a function before the single product page is displayed.
  • Inside my_remove_simple_price(), we’re checking if the product type is simple.
  • If it’s a simple product, we remove the action responsible for displaying the price.

Method 3: Removing Price Below Title for All Product Types

If you want to hide the price for all product types, regardless of whether they are simple or variable, use this method:

				
					add_action( 'woocommerce_before_single_product', 'my_remove_all_prices' );
function my_remove_all_prices() {
  global $product;
  if ( $product ) {
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price' );
  }
}

				
			

Explanation:

  • In this method, we’re not checking for specific product types. We’re simply ensuring that if there’s a product, we remove the price action.
  • This is a broad approach and will hide the price for all products on their single product pages.

Method 4: WordPress Plugin

For users seeking a plugin-based approach, “Hide Price & Hide Add to Cart WooCommerce” is a popular choice. Here’s how to use it:

Install and Activate the Plugin:

  • Navigate to your WordPress dashboard.
  • Go to Plugins > Add New.
  • Search for “Hide Price & Hide Add to Cart WooCommerce.”
  • Install and activate the plugin.

Configure Plugin Settings:

  • Once activated, go to WooCommerce > Settings > Hide Price & Hide Add to Cart.
  • Here, you’ll find options to hide prices and/or add to cart buttons.
  • You can choose to hide prices globally or on specific product pages.

Save Changes:

  • After configuring your preferences, remember to save changes.

Note: You can also try this free plugin ZI Hide price and add to cart for WooCommerce

Conclusion

Whether you prefer manual coding or plugin integration, hiding price ranges on WooCommerce single product pages is achievable. For users comfortable with PHP and WordPress development, manual coding provides granular control over product views. On the other hand, plugins like “Hide Price & Hide Add to Cart WooCommerce” offer a user-friendly alternative for those looking for a quick and hassle-free solution.

In the end, the choice between manual coding and plugin integration comes down to your technical expertise and desire for simplicity. Regardless of the method chosen, achieving a customized look for your WooCommerce store ensures that your products are presented in the best possible light to effectively engage and convert customers.

I hope this article helped you to learn about Hiding Price Range in WooCommerce Single Product Page. If you have any doubts or problem with the code, comment below to find the solutions. Also share this blog if you find this useful.

Want to build professional website for your Business or Store, Get a free quote here

Click here to get Premium Plugins and Themes at rs.249. Get 20% Off on your first order “WELCOME20”

Related Posts

Write a comment

Recent Posts

Categories

Tags

SCAN ME TO GET CURRENT PAGE LINK
Md Asik QR Code
Thank you for submitting. We’ll get back to you shortly