I'm using the WooCommerce Waitlist plugin, but I'd like to change it to be for products that haven't been released yet, ie for "expressions of interest".
To do this I need to change a lot of strings, for example one that says "Join the waitlist to be emailed when this product becomes available".
I've found where this is set in the plugin: the file...
wcwl-waitlist-template-functions.php
... in the root folder of the plugin.
If this was a theme I could replicate this file in my child theme and modify the strings, but as it's a plugin I'm all out at sea. And redeclaring the function causes an error. Any help would be much appreciated.
Here's the code of the function...
/**
* Get the default intro text to display above the waitlist dependent on product type
*
* @param string $product_type simple/variation/grouped (variation is the same as simple by default)
* @param bool $user_is_on_waitlist
*
* @return mixed|void
*/
function wcwl_get_intro_text( $product_type = 'simple', $user_is_on_waitlist = false ) {
$context = 'join';
$text = __( 'Join the waitlist to be emailed when this product becomes available', 'woocommerce-waitlist' );
if ( $user_is_on_waitlist ) {
$context = 'leave';
$text = __( 'You are on the waitlist for this product', 'woocommerce-waitlist' );
} elseif ( 'grouped' === $product_type || 'event' === $product_type ) {
$context = $product_type;
$text = __( 'Check the box alongside any Out of Stock products and update the waitlist to be emailed when those products become available', 'woocommerce-waitlist' );
}
return apply_filters( 'wcwl_' . $context . '_waitlist_message_text', $text );
}
I'm using the WooCommerce Waitlist plugin, but I'd like to change it to be for products that haven't been released yet, ie for "expressions of interest".
To do this I need to change a lot of strings, for example one that says "Join the waitlist to be emailed when this product becomes available".
I've found where this is set in the plugin: the file...
wcwl-waitlist-template-functions.php
... in the root folder of the plugin.
If this was a theme I could replicate this file in my child theme and modify the strings, but as it's a plugin I'm all out at sea. And redeclaring the function causes an error. Any help would be much appreciated.
Here's the code of the function...
/**
* Get the default intro text to display above the waitlist dependent on product type
*
* @param string $product_type simple/variation/grouped (variation is the same as simple by default)
* @param bool $user_is_on_waitlist
*
* @return mixed|void
*/
function wcwl_get_intro_text( $product_type = 'simple', $user_is_on_waitlist = false ) {
$context = 'join';
$text = __( 'Join the waitlist to be emailed when this product becomes available', 'woocommerce-waitlist' );
if ( $user_is_on_waitlist ) {
$context = 'leave';
$text = __( 'You are on the waitlist for this product', 'woocommerce-waitlist' );
} elseif ( 'grouped' === $product_type || 'event' === $product_type ) {
$context = $product_type;
$text = __( 'Check the box alongside any Out of Stock products and update the waitlist to be emailed when those products become available', 'woocommerce-waitlist' );
}
return apply_filters( 'wcwl_' . $context . '_waitlist_message_text', $text );
}
You are able to change texts using a translation file.
By default, plugin texts are in the English language. Even your site language is English, You are able to generate a new language file and change texts on it.
Imagine that the plugin folder name (plugin slug, plugin text domain) is my-plugin and Your site language is set to English (UK) in Admin Dashboard -> Settings -> General Settings -> Site Language.
So, Create a new translation using Poedit and set the translation language to English (UK). Then change texts as You want and save the translation file. You can use the pot
file that comes with the plugin and most of the time it exists in the language
folder.
It will give You two files named as en_GB.po
and en_GB.mo
. Rename files to my-plugin-en_GB.po
and my-plugin-en_GB.mo
and move them to wp-content/languages/plugins
folder. Refresh the site and texts should be changed.
You can change text using filter. add below code in active theme's functions.php file to change text form join waitlist message. Here is a documentation where you can take reference. : https://docs.woocommerce/document/woocommerce-waitlist/
add_filter( 'wcwl_join_waitlist_message_text', 'change_string_from_woo_wait_list',10,1 );
function change_string_from_woo_wait_list($text)
{
$text = __( 'Custom Text' ); // change text here
return $text;
}
Let me know if this works for you!