luissimo
luissimo

Reputation: 978

How to change 'select an option' text from 'WooCommerce Product Add-ons' plugin

i'm using the woocommerce product Add-ons plugin and i want to change the default value that appears on dropdowns that says 'select an option':

enter image description here

I managed to find all other english texts in the plugins editor and changed them but this single line is bugging me because i can't seem to find where it is initialized.

EDIT

This is the exact plugin i'm using:

Woocommerce product Add-Ons

Any help would be much appreciated!

Upvotes: 2

Views: 4170

Answers (2)

Arjan
Arjan

Reputation: 1

Use this code and place it into functions.php

add_filter( 'gettext', 'customizing_product_variation_message', 10, 3 );
function customizing_product_variation_message( $translated_text, $untranslated_text, $domain )
{
if ($untranslated_text == 'Select an option...') {
    $translated_text = __( 'PAST YOUR TEXT HERE', $domain );
}
    if ($untranslated_text == 'None') {
    $translated_text = __( 'PAST YOUR TEXT HERE', $domain );
}
return $translated_text;
}

Upvotes: 0

The quickest way would be to add a line on your functions.php child theme where you can change text:

add_filter( 'gettext', 'customizing_product_variation_message', 10, 3 );
function customizing_product_variation_message( $translated_text, $untranslated_text, $domain )
{
if ($untranslated_text == 'Select an option...') {
    $translated_text = __( 'ENTER HERE THE NEW TEXT', $domain );
}
return $translated_text;
}

Bear in mind that you might need to remove the ... at the end of the "Select an option" text.

Hope that helps

Upvotes: 2

Related Questions