Are you tired of the same old, mundane default texts that come with your WordPress WooCommerce plugin? Do you wish you could add a personal touch to your online store and make it truly unique? Well, you're not alone. Many online store owners feel the urge to break free from the standard "one-size-fits-all" approach and customize their store's appearance and messaging.
In this blog post, we'll dive deep into the world of WordPress WooCommerce customization, starting with one of the most commonly changed default texts – "On Stock."
We'll show you how easy it is to transform your online store's language and style to better reflect your brand's identity. Say goodbye to generic messages and hello to a personalized shopping experience that keeps your customers coming back for more.
Changing “On Stock” Text to Custom One
To begin customizing your WooCommerce store's "Out of Stock" text, the first step involves accessing your WordPress Dashboard using your login credentials. Once you're logged in, navigate to the "Appearance" tab on the left-hand menu and select "Editor."
Create Amazing Websites
With the best free page builder Elementor
Start NowOnce you've entered the editor, look for the "functions.php" file within the list of your theme's files. It's typically located in the right column. Click to open this file.
With the "functions.php" file open, scroll down to its very end. Here, you'll want to insert the following lines of code to make the desired changes to your "Out of Stock" text.
add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2);
function wcs_custom_get_availability( $availability, $_product ) {
// Change In Stock Text
if ( $_product->is_in_stock() ) {
$availability['availability'] = __('Available!', 'woocommerce');
}
// Change Out of Stock Text
if ( ! $_product->is_in_stock() ) {
$availability['availability'] = __('Sold Out', 'woocommerce');
}
return $availability;
}
After adding the necessary lines of code, don't forget to save your changes. This step is crucial to ensure that your custom text will be displayed throughout your WooCommerce store.
And just like that, you've successfully swapped out the default "On Stock" text with your very own custom message, giving your online store a unique and personalized touch that sets it apart from the rest.
Wrapping Up
In conclusion, customizing default texts in your WordPress WooCommerce store is a simple yet powerful way to infuse your brand's personality and uniqueness into every aspect of your online shopping experience. Whether it's replacing the "On Stock" text or personalizing other elements, like product descriptions or checkout messages, taking control of your store's language can make a significant difference in how customers perceive and engage with your business.