[Resolvido] Translated product shows as "out of stock" despite original having stock
Este tópico foi resolvido. Aqui está uma descrição do problema e da solução.
Problema: Se você está usando o WPML com o WooCommerce e notou que um produto traduzido aparece como 'sem estoque', apesar de haver estoque no produto original, e também está enfrentando um problema onde o menu do cabeçalho aparece sob as imagens do produto nas páginas traduzidas, indicando um problema de z-index. Solução: Primeiro, verifique as configurações de tradução de campos personalizados em WPML > Configurações > Tradução de Campo Personalizado e clique em "Mostrar campos do sistema". Certifique-se de que o campo _stock esteja configurado para "Não traduzir". Os seguintes campos devem ser configurados para "Copiar":
total_sales
_backorders
_downloadable
_download_expiry
_download_limit
_manage_stock
_virtual
_weight
_width
_price
_regular_price
_sale_price
_sku
_sold_individually
_stock_status
_tax_class
_tax_status
O campo _purchase_note deve ser configurado para "Traduzir". Após ajustar essas configurações, atualize as traduções dos seus produtos. Se ainda enfrentar problemas, pode ser necessário atualizar ou desativar temporariamente o plugin "CommerceGurus CommerceKit" e salvar novamente o produto original para sincronizar o estoque.
Se a solução fornecida não resolver o problema ou se parecer irrelevante devido a atualizações ou especificidades do seu caso, recomendamos que abra um novo ticket de suporte em fórum de suporte WPML. Também é altamente recomendável verificar problemas conhecidos em https://wpml.org/known-issues/, verificar a versão da correção permanente e confirmar que você instalou as versões mais recentes de temas e plugins.
Este é o fórum de suporte técnico para o WPML — o plugin de WordPress multilíngue.
Todos podem ler, mas apenas clientes do WPML podem postar aqui. A equipe do WPML responde no fórum 6 dias por semana, 22 horas por dia.
Histórico da questão:
I am using WPML with WooCommerce on my site link oculto. I have a product created in Portuguese with available stock. After translating it into Spanish, the translated version appears as 'out of stock' even though the original has stock. I have confirmed that stock is available in the original product, the translation is correctly linked, and WPML and all related plugins are up to date. Additionally, on translated product pages, the header menu appears underneath the product images, indicating a z-index issue. Link to a page where the issue can be seen: link oculto
Sintomas:
The translated product shows as 'out of stock' despite the original having stock. The header menu appears underneath the product images on translated product pages, suggesting a z-index issue.
Perguntas:
Why does the translated product show as 'out of stock' when the original has stock?
How can I fix the z-index issue with the header menu on translated product pages?
This sounds like a configuration issue. Please go to WPML > Settings > Custom Field Translation and click "Show system fields". Now in the bottom right corner, click to see all results or use the text search field to find specific fields:
Make sure that the field _stock is set to "Don't translate".
I would like to request temporary access (wp-admin and FTP) to the staging site to investigate the issue further.
The required fields are located below the comments section when you log in to leave the next reply. The information you provide is private, meaning only you and I can see and access it.
IMPORTANT
Please be sure to back up your website and database before granting us access.
If you can't see the "wp-admin / FTP" fields, your post and website credentials will be set to "PUBLIC." DO NOT publish the data unless you see the required wp-admin / FTP fields.
The private reply form looks like this: link oculto
Click "I still need assistance" the next time you reply.
Video: link oculto
Please note that we are required to request this information individually on each ticket. We are not permitted to access any credentials that were not specifically submitted on this ticket using the private response form.
It seems like updating "CommerceGurus CommerceKit" solves this issue, but you will need to save the original product again afterwards, so that the stock gets synced.
I’ve updated CommerceGurus CommerceKit and re-saved the original product as suggested, but unfortunately the issue still persists. The translated product still shows as out of stock. I can see that on the staging is working.
My apologies, maybe I might have misinterpreted the cause of the issue.
What I did on the staging was deactivate various WooCommerce addons, and on each step, I tested if the issue persisted while updating the stock and even retranslating the product.
At some point, suddenly, even the stock changed on the original product to "1", which made me even more curious that there might be an issue even when testing without WPML.
It seemed to me that the issue was solved when deactivated "CommerceGurus CommerceKit".
After that, I edited the original stick again, as it was suddenly set to "1", and when saving the original product, the issue was solved.
I did not update any other plugin, which means the issue might have solved itself after I deactivated one of the WooCommerce add-ons.
As the issue currently does not occur on the staging, it might be hard to find out which addon caused the issue.
If you would like to provide me with access to the live site, I could try to enable WP DEBUG to see if I can trigger an error that could answer this question, without the need to deactivate any plugins.
I disabled "CommerceGurus CommerceKit" and the stock on the original product changed to "1". I then set the stock back to "372" and saved the original product again, and it solved the issue.
If this issue occurs again, please let me know, but after all, this does not seem to be an issue caused by WPML.