How to Remove Sale Price from WooCommerce Product Page
If you’re looking to create a more streamlined and consistent shopping experience on your WooCommerce store, you might want to remove the sale price from the product page. Whether it’s for promotional reasons or to maintain a uniform pricing structure, removing the sale price can be a simple task if you know the right steps. In Read more about How To Add A Product To Woocommerce this comprehensive guide, we’ll walk you through the process of removing the sale price from your WooCommerce product pages.
Why Remove Sale Price from WooCommerce Product Pages?
Removing the sale price from your WooCommerce product pages can have several benefits:
- **Maintain Consistency**: If your store’s design leans towards simplicity, having a single price displayed can enhance the overall look and feel.
- **Avoid Confusion**: Multiple price displays might confuse customers. A single price point ensures clarity.
- **Strategic Marketing**: You may want to highlight sales differently, such as through banners or pop-ups, instead of using the default sale price display.
- Go to **Appearance** > **Theme Editor**.
- On the right-hand side, locate and click on the **functions.php** file. This is where you will add the custom code.
Steps to Remove Sale Price from WooCommerce Product Pages
To remove the sale price from WooCommerce product pages, you can use custom code or plugins. Here’s a step-by-step guide on how to achieve this using custom code.
Step 1: Access Your WordPress Dashboard
Begin by logging into your WordPress dashboard. This is your control center where you can manage all aspects of your WooCommerce store.
Step 2: Backup Your Website
Before making any changes, it’s crucial to backup your website. This ensures that you can restore your site in case anything goes wrong.
Step 3: Navigate to the Theme Editor
Step 4: Add Custom Code
To remove the sale price from the WooCommerce product page, you’ll need to insert the following code into the `functions.php` file:
add_filter('woocommerce_get_price_html', 'remove_sale_price', 100, 2);
function remove_sale_price($price, $product) {
// Check if the product is on sale
if ($product->is_on_sale()) {
// Get the regular price
$regular_price = $product->get_regular_price();
// Return only the regular price
return wc_price($regular_price);
}
return $price;
}
Step 5: Save Changes
After adding the code, click on the Update File button to save your changes. This code will ensure that only the regular product price is displayed on your WooCommerce product pages, effectively removing the sale price.
Step 6: Clear Cache and Test
- **Clear Cache**: If you are using a caching plugin, make sure to clear the cache to ensure the changes are reflected on your site.
- **Test Your Site**: Visit your product pages to verify that the sale price has been successfully removed.
Alternative Method: Use a Plugin
If you’re not comfortable editing code, consider using a plugin to achieve the same result. Plugins like Code Snippets allow you to add custom code without directly modifying your theme files.
Using the Code Snippets Plugin
- Install and activate the **Code Snippets** plugin from the WordPress repository.
- Navigate to **Snippets** > **Add New**.
- Name your snippet and paste the above code into the code area.
- Save and activate the snippet.
Conclusion
Removing the sale price from your WooCommerce product pages can help you create a more cohesive and straightforward shopping experience. By following the steps outlined in this guide, you can easily customize your store’s appearance and ensure that your pricing strategy aligns with your business goals. Whether you choose to add custom code directly or use a plugin, the process is straightforward and can significantly enhance your store’s user experience.
Remember, it’s always important to backup your website before making any changes, and test thoroughly to ensure everything works as expected. With these steps, you’re well on your way to optimizing your WooCommerce product pages for a cleaner, more professional look.