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 thread is resolved. Here is a description of the problem and solution.

Problem:
Tbay Framework - Not showing OUT OF STOCK label in main language
Solution:
The problem is that here: wp-content/themes/greenmart/inc/vendors/woocommerce/functions.php
line 1597:

if ( $availability['availability'] == 'Out of stock') {
   $return_content .= '<span class="out-stock">'. esc_html__('Out of stock', 'greenmart') .'</span>';
}

it is comparing with the English string: Out of stock. But $availability['availability'] gets the current language string, as expected.

So, to fix that, replace that code with:

if ( $availability['availability'] == __('Out of stock', 'woocommerce')) {
   $return_content .= '<span class="out-stock">'. esc_html__('Out of stock', 'greenmart') .'</span>';
}

This topic contains 7 replies, has 2 voices.

Last updated by mohammadA-23 5 months, 2 weeks ago.

Assigned support staff: Riffaz.

Author Posts
April 14, 2019 at 11:20 am

mohammadA-23

if the product is out of stock, the picture will show "out of stock" but Germany and arabic will not work. I do not see that in the picture.
Only on the English side does it work.
please see screenshot

I ask for urgent support.

April 14, 2019 at 11:56 am #3607839

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

Thank you for contacting WPML support.

Please follow this: https://wpml.org/forums/topic/woocommerce-out-of-stock-products-displaying-in-translations/#post-2713880 if that does not help check this: https://wpml.org/forums/topic/woocommerce-out-of-stock-products-displaying-in-translations/#post-2734628

If you still see the issue even after tried both options above. there could be element/css copying issue.
In that case, we need to check this in a fresh installation.

Let me know how it goes.

Regards,
Riffa.

April 14, 2019 at 5:07 pm #3608445

mohammadA-23

Dear Support Team,

Thank you for your quick response.
Unfortunately, I have already tried your suggestion but it did not work.

Is there any other way to solve my problem?

April 15, 2019 at 1:21 pm #3613701

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

Please,
1. go to hidden link
2. install your theme
3. configure WPML as you have it in your site. at the last step just click next (site key)
4. create only one product
5. make it out of stock
6. translate it
7. recreate the issue.

Let us know step by steps how to check this and reproduce this issue.

Regards,

April 16, 2019 at 7:52 am #3619317

mohammadA-23

it has not changed, the problem is still there.
only english works, german arabic not

April 18, 2019 at 7:36 am #3636863

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

Thank you for this.

I sent this to our compatibility team as Tbay is not listed in our plugin compatible list and the issue is reproduced in a fresh installation.

Please be patient till we get back to you.

Regards,

May 5, 2019 at 6:01 am #3741805

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

The problem is that here:

wp-content/themes/greenmart/inc/vendors/woocommerce/functions.php

line 1597:

if ( $availability['availability'] == 'Out of stock') {
   $return_content .= '<span class="out-stock">'. esc_html__('Out of stock', 'greenmart') .'</span>';
}

it is comparing with the English string: Out of stock. But $availability['availability'] gets the current language string, as expected.

So, to fix that, replace that code with:

if ( $availability['availability'] == __('Out of stock', 'woocommerce')) {
   $return_content .= '<span class="out-stock">'. esc_html__('Out of stock', 'greenmart') .'</span>';
}

Please, give it a try and update.

Let me know how it goes.

Regards,

May 5, 2019 at 6:51 am #3741839

mohammadA-23

My issue is resolved now. Thank you!