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: I am trying to: List my featured products in English (Spanish is primary language). I expected to see: featured products listed as on the Spanish page. I am using a custom query to retrieve the featured products. Solution: The featured products needed to be set as featured again because the meta wasn't set fine the first time. Once the products were set again as featured, everything went back to normal.

This topic contains 11 replies, has 2 voices.

Last updated by salvadorC 4 months, 3 weeks ago.

Assigned support staff: Radu.

Author Posts
April 18, 2019 at 8:01 am #3636965

salvadorC

I am trying to: List my featured products in English (Spanish is primary language)

Link to a page where the issue can be seen: hidden link

I expected to see: featured products listed as on the Spanish page, hidden link

Instead, I got: Nothing

I tried to follow the steps of this post (https://wpml.org/forums/topic/featured-products-dont-show-in-second-language/) but I do not know where can I delete the translated term called feature.

Thanks!

April 18, 2019 at 8:51 am #3637471

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Salvador,

Can you tell me how this section is created, please? Is it made using the Did you use the [featured_products] shortcode or is this an option from the theme? Also, are the featured products still missing from the translated page if you deactivate all the plugins not related to WPML or WooCommerce and activate a default theme (like Twenty Nineteen)? I just want to make sure that this is not an issue related to a plugin or to the theme that you're using.

Thanks,
Radu

April 25, 2019 at 7:25 am #3679471

salvadorC

Hi Radu.
Sorry for my delay. I´ve been on vacation.
I´ve tried deactivating all plugins except for woocommerce an wpml and the problem persists.

This is how I show my featured products on my custom theme:

<?php
$args = array(
'post_type' => 'product',
// 'suppress_filters' => true,
'posts_per_page' => 8,
'tax_query' => array(
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
),
),
);

$featured_query = new WP_Query( $args );
if ($featured_query->have_posts()) : ?>

<div class="grid-x grid-padding-x small-up-2 medium-up-4">
<?php
while ($featured_query->have_posts()) :
$featured_query->the_post();
$product = wc_get_product( $featured_query->post->ID );?>
<div class="cell home__featured-product">
<a href="<?php echo get_permalink( $post->ID ) ?>" title="<?php echo esc_attr($post->post_title ? $post->post_title : $post->ID); ?>">
<?php echo the_post_thumbnail($post->ID); ?>
<h3 class="product-title text-center"><?php the_title(); ?><span class="price"> <?php echo $product->get_price_html(); ?></span></h3>
</a>
</div>
<?php
endwhile;
?>
</div>
<?php
endif;
wp_reset_query();
?>

I´ve also tried the following code:

<?php echo do_shortcode( '[products limit="8" columns="4" visibility="featured" ]' ); ?>

Thanks!

April 25, 2019 at 10:04 am #3680913

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Salvador,

Is there any chance that you could give me access to the dashboard area of your website, please? I need to check a few settings to see what I can do in order to make this work fine. I set the next reply to be private so just you and I can see the credentials.

Thanks,
Radu

May 2, 2019 at 8:50 am #3722807

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Salvador,

Sorry about this late reply. This ticket got lost and I checked it a bit late. I just checked the English version of your website: hidden link and I could see that there's a product displayed on the featured section. I also looked at the other products (like this for example hidden link) and I could see that its status is Pending Review. Can you hit the Publish button, make it featured, and tell me if it appears on the homepage too, please?

Thanks,
Radu

May 6, 2019 at 12:04 pm #3748091

salvadorC

Hi Radu!
You´re right there´s one product displayed in featured section and most english products are in pending review status. But I´ve changed one, that is marked as featured, to Publish and it don´t appears on homepage.
Thanks!

May 7, 2019 at 8:57 am #3755645

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Salvador,

Please go to Dashboard → WooCommerce → WooCommerce Multilingual → Status tab, press the Troubleshooting button from the bottom right corner, and try all the options from here (except for the Duplicate terms one). Also, can you tell me where or how did you add this custom query to the homepage, please? Are the products appearing if you try to remove the part where you get only the featured products? I just want to see if it's working for all the products and they investigate why is it not filtering only the featured ones.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of site files and database before using all the options from the troubleshooting section.

Thanks,
Radu

May 8, 2019 at 6:59 am #3764247

salvadorC

Hi Radu.
At this moment I´m doing the process that you´ve told me. But it goes on a loop and doesn´t end.
On the other hand, I´ve made a custom theme using _underscores and the initial page is a template in which I´ve pasted the code.
I´ve automatic backups every day.
Thanks again!

May 8, 2019 at 1:15 pm #3767105

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Salvador,

I checked the code that you're using and I could see that there's a $post->post_title part on it but this $post is not declared anywhere. I think you should use $product. I just used this code on my side:

$args = array(
            'post_type' => 'product',
            'suppress_filters' => false,
            'posts_per_page' => 12,
            'tax_query' => array(
                    array(
                        'taxonomy' => 'product_visibility',
                        'field'    => 'name',
                        'terms'    => 'featured',
                    ),
                ),
            );
        $loop = new WP_Query( $args );
        if ( $loop->have_posts() ) {
            while ( $loop->have_posts() ) : $loop->the_post();
                wc_get_template_part( 'content', 'product' );
            endwhile;

and it works well. It displays the featured products in each language. Can you try it on your side too and tell me if it's working, please?

Thanks,
Radu

May 13, 2019 at 11:40 am #3797591

salvadorC

Hi Radu.
I removed that line of code and still not working.
Thanks!

May 14, 2019 at 9:52 am #3805537

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Salvador,

I added a small piece of code to the functions.php file. Now, you can access this link: hidden link to see all the products that are set as featured. The ones in Spanish are under the featured slug while the one in English have the featured-en slug. You can see here the number of featured products in each language. Can you have a look and see if this is the right count?

Thanks,
Radu

May 22, 2019 at 7:52 am #3862651

salvadorC

Hi Radu.
It´s pretty weird. It says that they´re 20 featured products in spanish but it only shows 18. In english is ok. I´m gonna close the ticket because at this time is working. But sometimes it does and other it doesn´t. So maybe in the future I´ll open another with the same issue.
Thanks very much!