As a WooCommerce store owner/manager, in some cases, you may need to change the “In Stock” text. In this article, Today we are going to talk about How To Change In Stock Label in WooCommerce. You can change it very easily by following the steps mentioned below:
STEP : 1 Go to your theme editor and find your active theme’s functions.php file.
STEP : 2 Copy the codes mentioned below and paste it to your functions.php file. Please make sure to take a backup of your functions.php file before making any changes.
/**
* Change WooCommerce In Stock text
*/
function fwp_change_in_stock_text( $availability, $_product ) {
// Change In Stock Text
if ( $_product->is_in_stock() ) {
$availability['availability'] = __('Product Available on Request', 'woocommerce');
}
return $availability;
}
add_filter( 'woocommerce_get_availability', 'fwp_change_in_stock_text', 1, 2);
NOTE: Please make sure to change the text “Product Available on Request” according to your needs.
How to change In Stock and Out Of Stock text label in WooCommerce
Would you like to change the “In Stock” and “Out Of Stock” text conditionally? If Yes, Please follow the instructions mentioned below. In this case, you also need to find your active theme’s functions.php file and then you need to add a small code snippet to it.
/**
* Change WooCommerce In Stock and Out of Stock Text Label
*/
function fwp_custom_stock_text( $availability, $_product ) {
// Change In Stock Text
if ( $_product->is_in_stock() ) {
$availability['availability'] = __('Product Available on Request', 'woocommerce');
}
// Change Out of Stock Text
if ( ! $_product->is_in_stock() ) {
$availability['availability'] = __(' Product Sold Out', 'woocommerce');
}
return $availability;
}
add_filter( 'woocommerce_get_availability', 'fwp_custom_stock_text', 1, 2);
Please note in this case you also need to change the text label according to your needs.
N.B. This is a developer-level tutorial. If you feel, it’s difficult to do for you. You may consider hiring me through Fiverr. I’ll fix your issue as soon as possible.
Table of Contents :
- How To Display Date And Time In WordPress
- Multiple Ways To Change WordPress Site URL
- How To Add Facebook Page Feed On Your Website
- How To Change Admin Color Scheme In WordPress
- How to add WordPress site to Google Search Console
- How to find out which version of WordPress a site is using
- Change RETURN TO SHOP Link in WooCommerce
- Remove Related Products on WooCommerce
- Change Add to Cart Text in WooCommerce
- Disable Gutenberg Widget Block Editor
- Best Auto Backup & Auto Migration Plugin in WordPress
- How to change WordPress admin password from database