Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Osama Mersal 1 year, 4 months ago.

Assisted by: Osama Mersal.

Author Posts
September 24, 2023 at 8:07 am #14451681

ofirG

Hey, I added a custom code to my functions.php and I can't find it on string translation.
I saw a thread that had the same issue and I tried to edit the code as suggested but it doesn't work well as it crashed my site.
This is the code:

add_action('woocommerce_checkout_process', 'wpsh_validate_phone');
function wpsh_validate_phone() {
if (isset($_POST['billing_phone'])) {
$phone = strlen(preg_replace('/[^0-9]/', '', $_POST['billing_phone']));
if ($phone < 6) {
wc_add_notice( __( 'Billing Phone must be at least 6 digits long.' ), 'error' );
}
}
}

September 25, 2023 at 7:20 am #14454835

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

I'm afraid supporting custom code is out of our support scope. Kindly check our support policy. (https://wpml.org/purchase/support-policy/)

In order to translate code strings, you need to use the GetText call. Kindly check our guide about translating custom code. (https://wpml.org/documentation/support/translating-the-theme-you-created/)

I hope this helps you. If you need further info, please let me know.

Best regards,
Osama

September 25, 2023 at 6:06 pm #14461601

ofirG

Manage to solve it.

Thanks!