OhhMuaOhhMua
  • Home
  • Hosting
    • Best Web Hosting
    • Free Web Hosting
    • VPS Hosting
  • WordPress
    • Solutions & Troubleshooting
    • Installation & Setup
    • Themes & Plugins
    • Security
  • Computer Tips
    • Gaming Errors & Solutions
    • PC Troubleshooting
    • Computer Hardware
  • Coupons & Deals
  • Contact Us
Reading: Change 0 Price or Empty Price to ‘Call for Price’ in WooCommerce
Share
Notification Show More
Font ResizerAa
OhhMuaOhhMua
Font ResizerAa
  • Computer Tips
  • Hosting
  • WordPress
Search
  • Home
  • WordPress
    • Installation & Setup
    • Security
    • Solutions & Troubleshooting
    • Themes & Plugins
    • Troubleshooting
  • Hosting
    • Free Web Hosting
    • VPS Hosting
    • Best Web Hosting
  • Computer Tips
    • Computer Hardware
  • Coupons & Deals
Have an existing account? Sign In
Follow US
Copyright © 2024 ohhmua. All rights reserved.
OhhMua > Blog > WordPress > Solutions & Troubleshooting > Change 0 Price or Empty Price to ‘Call for Price’ in WooCommerce
Solutions & Troubleshooting

Change 0 Price or Empty Price to ‘Call for Price’ in WooCommerce

ohhmua
Last updated: September 8, 2024 6:16 am
ohhmua
Share
2 Min Read
Change 0 Price or Empty Price to 'Call for Price' in WooCommerce
Change 0 Price or Empty Price to 'Call for Price' in WooCommerce
SHARE
Contents
Code Explanation:Conclusion:

If you want to change the price of 0 or leave the price field empty to display “Call for price” in WooCommerce, you can refer to the code below.

Code to Change 0 Price or Empty Price to “Call for Price” in WooCommerce

You can add the following code to the functions.php file of your child theme:

add_filter('woocommerce_get_price_html', 'custom_empty_price_message', 10, 2);
function custom_empty_price_message($price, $product) {
    if ($product->get_price() === '' || $product->get_price() == 0) {
        $price = '<span class="webantam-woocommerce-price-contact">Call for Price</span>';
    }
    return $price;
}

Code Explanation:

  • if ($product->get_price() === ” || $product->get_price() == 0): This conditional statement checks whether the product price is either an empty string (meaning you didn’t enter a price) or if the price is 0.
  • $price = ‘Call for Price’; If the above condition is met, this line replaces the product price with the HTML string <span class="webantam-woocommerce-price-contact">Call for Price</span>. This will display the text “Call for Price” on the WooCommerce product page.

Conclusion:

With just a simple code snippet, you can easily solve the issue of changing a 0 price or empty price to display “Call for Price” in WooCommerce. If you encounter any issues during the process, feel free to reach out!


You Might Also Like

How to Add a “Read More” and “Show Less” Button to Product Descriptions in WooCommerce

Blog, E-Commerce, or Forum? WordPress Covers Every Website Type!

How I Optimized Pagination and Skyrocketed Traffic

How to Pick the Ideal Blogging Platform for Your Needs

Protecting Your WordPress Site from File Upload Vulnerabilities

Share This Article
Facebook Twitter Email Print
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Trending Stories

Comprehensive Computer Beep Codes [Help You Fix Errors]
Computer Hardware

Comprehensive Computer Beep Codes [Help You Fix Errors]

August 22, 2020
Guide to Choosing the Best Gaming CPU
Computer Hardware

Guide to Choosing the Best Gaming CPU

July 28, 2020
Unboxing the seagate Ultra ssd
Computer Hardware

2TB in Your Pocket: Discover Seagate’s Ultra-Compact SSD

April 19, 2025
Contact button
Solutions & Troubleshooting

Contact button in the footer with added call button shake effect

September 21, 2024
Top Free WordPress Plugins for Bloggers in 2025
Themes & Plugins

Top Free WordPress Plugins for Bloggers in 2025

May 3, 2025
wordpress.com vs wordpress.org
Themes & Plugins

WordPress.com vs WordPress.org: A Beginner’s Guide to Choosing the Right Platform

April 26, 2025

You Might Also Like

Title and Meta Description Mismatch on Google
Solutions & Troubleshooting

Title and Meta Description Mismatch on Google[How to fix]

September 25, 2024
Guide to Creating a Beautiful Promotion Notification Box for Your Website
Solutions & Troubleshooting

How to Create a Stunning Notification Box for Your Website

September 20, 2024
Create a Simple Incrementing Number Effect with HTML and JavaScript 2
Solutions & Troubleshooting

Create a Simple Incrementing Number Effect with HTML and JavaScript

September 17, 2024
Guide to Using Multiple Domains for One WordPress Website
Solutions & Troubleshooting

Guide to Using Multiple Domains for One WordPress Website

September 16, 2024
Previous Next
newsletter featured

Always Stay Up to Date

Subscribe to our newsletter to get our newest articles instantly!

Follow US on Social Media

Facebook Youtube Steam Twitch Unity

Copyright © 2024 ohhmua. All rights reserved.

OhhMua

Information

  • About
  • Terms & Conditions
  • Privacy Policy
Welcome Back!

Sign in to your account

Lost your password?