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.

Our next available supporter will start replying to tickets in about 8.52 hours from now. Thank you for your understanding.

This topic contains 8 replies, has 2 voices.

Last updated by The J 1 month, 3 weeks ago.

Assigned support staff: Yvette.

Author Posts
May 22, 2019 at 1:42 pm

The J

On a 100% custom site, I am having quite some issues with WPML and WooCommerce (I have other 2 tickets still open for this site).

One of them is that feat products in a custom loop, show in english but not in the site's default language.
In backend they are both set to featured (original product and english translation).

May 22, 2019 at 5:19 pm #3868289

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello

I´ll be helping you. Can you tell me how to see this issue on your site?
Could you also share the code you are using in your custom loop?

Thanks

May 27, 2019 at 12:59 pm #3897391

The J

You will find the loop inside templates/frontpage.php

I tried several ways, this one shows feat products in english, but not in the default site lang:

$homeArgs = array(
	'orderby' => 'menu_order',
	'order'   => 'ASC',
	'post_type' => 'product',
	'posts_per_page' => 10,								
	'tax_query' => array(
		'relation' => 'AND',
			array(
				'taxonomy'      => 'product_cat',
				'field' 		=> 'term_id',
				'terms'         => 1234,
				'operator'      => 'IN'
			),
			array(
			       'relation' => 'OR',
				        array(
					      'taxonomy' => 'product_visibility',
           				       'field'    => 'name',
					       'terms'    => 'featured',
					       'operator' => 'IN',
				         ),
				         array(
					      'taxonomy' => 'product_visibility',
					      'field'    => 'name',
					      'terms'    => 'featured',
				         ),
			        )
			)
		);
May 27, 2019 at 5:19 pm #3899861

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello

It does not seem that the problem is with your program. I´ve checked the database for post types that fall under the "featured" taxonomy term for IT.

Techincally, this would mean any posts that are assigned to term with id = 1046 (see images).
Right now, the count for this taxonomy term = 0. This indicates that there are no products in this taxonomy term....in other words, there are no assigned IT products to the featured product term.

So, perhaps this is a data issue.

Furthermore, I compared your term setup with one of my test sites and I in my system the taxonomy "product_visibility" is not set as translatable. In your system, this taxonomy has been translated.

So, I think this reinforces the idea that your system configuration is incorrect. I wait for your feedback on these obserations.

May 27, 2019 at 6:30 pm #3900243

The J

Great! so that seems to be problem then.
So can you tell me how to set it up instead? 🙂

May 28, 2019 at 6:38 am #3903059

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello

I can confirm that the problem is not with your code but with the data storage. I´ve manually assigned the correct term to the existing featured products and you can see that the IT page now shows featured products.

However, your system is always assigning the same "featured" term to all products.

In the latest release of WCML, this should not be the case. The latest release will have a translated taxonomy term "product_visiibility" term "featured". And the corresponding product will be assigned the correct taxonomy term.

Since this is not related to your original question (e.g. your code) but rather on the way you system is behaving in storing the data, please open a new ticket on the forum.

You should use the following test case:
- create a new IT product and mark it as "featured"
- check the term count for the term-id = 8
- create a new EN product and mark it as "featured"
- check the term count for the term-id = 1046

In both cases, the count is incremented for the term-id=8 and ignored for term-id=1046. The result is that there are no featured products found in the default language "IT" that is associated with term-id=1046.

May 28, 2019 at 12:51 pm #3907147
The J

Sorry I dont understand what the fix is.
Do I need to change something in my WPML setup?
Do I just need to wait for an update of the WPML WC addon and the issue will be fixed on its own?

Please provide a solution I can use now or when the issue will be fixed on its own.

May 28, 2019 at 2:12 pm #3907815

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

There is an issue with the way your site is assigning taxonomy term "featured" in the second language.

It should go to a term-id of 1046 and instead it is going to term-id of 8.

I do not know why this is happening on your site. I cannot reproduce this on a new installation. It is a problem particular to your installation.

You opened a ticket requesting help with your code and we have determined that there is no problem with your code. The problem is the way your products are being assigned to taxonomy terms. This requires a different investigation.

I asked you to open a new ticket to investigate this matter as it is not related to your original request related to your code. But I can also just split the ticket here which is what I will do now.

We will continue the investigation of this behaviour in the new ticket. For now, you can please close this one.

May 28, 2019 at 3:39 pm #3908485

The J

Sorry, didnt understand what the next step was.
Thank you for splitting the ticket, hopefully we'll get to the bottom of the issue.