[Gelöst] displaying content based on the product stock conditionally
Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.
Problem:
Conditional content based on WooCommerce product stock quantity worked correctly in the default language but failed in translated pages. In the translation, either both buttons appeared or no buttons were visible because the conditional logic could not evaluate the stock value correctly.
Solution:
The stock quantity was not synchronized or set for the translated WooCommerce products. Toolset conditionals evaluate the stock value per language, so the translated products also needed a valid stock quantity. After adding or syncing the correct stock values in the translated products, the conditional display worked as expected.
I am displaying content based on the product stock. If the stock is greater than 0, a "buy" button is displayed. If the stock is 0, a "more information" button is displayed.
The page is in Catalan and translated into Spanish. It works well in Catalan. In the translation to Spanish, the conditional does not work and both buttons are displayed at the same time, because the conditional is not working well.
I am attaching an image with the conditional configuration.
Hello. Thank you for contacting the Toolset support.
Can you please share problem URL and admin access details and let me check what's going wrong with your setup.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
You added the conditoin NOT greater then zero that is not a legal conditoin. What if you disable the NOT clause.
I suggest you should output the stock quantity value for both empty and not empty products and then check what you get for emtpy field. If you get empty field value for stock equal to zero then you will have to configure your conditoinal statements accordingly.
If you get zero for stock quantity then condition should be if stock quantity equal to zero - show you things.
For quantity greater then zero the condition should be if stock quantity gerater than zero then show your things.
Hi Minesh,
I made the changes you suggested and it looks good in the main language but none of the buttons are visible in the translation...
It seems that the view is not working correctly in translation.
How can I fix it?
I mean that in the views where I have the same case (the conditional that I made as you told me) the conditionals are not visible in the translations (it happens in 3 views of the website)
- The view and conditionals and their translation are ok.
- The issue is the syncing between the stock quantity of the main and translated languages per product
- As soon as the correct number was added to the translation, it worked.
Hi Christopher,
I can't watch the video.
If I load it on this same page, the screen stays black and if I open it in a separate tab, it tells me that I don't have permissions (Access blocked: OTGS)
Tell me how I can see it.
Thanks,
Mar