Saltar navegación

Etiquetado: 

Este tema contiene 0 respuestas, tiene 0 voces.

Última actualización por christosK-16 hace 1 semana, 3 días.

Asistido por: Noman.

Autor Entradas
diciembre 23, 2024 en 1:31 pm #16540539

christosK-16

Background of the issue:
My site is built with Elementor and the Woodmart theme. I have added a code snippet that shows a message on each single product page depending on the stock status. The messages are in Greek, which is my native language. I am trying to translate them into English using WPML. Here is the code snippet I wrote: function stock_status_shortcode() { global $product; if (!$product) return ''; // Prevents errors on non-product pages if ($product->is_on_backorder(1)) { return '' . __('Κατόπιν Παραγγελίας Χρόνος Παράδοσης: 10-40 ημέρες', 'woocommerce') . ''; } elseif ($product->is_in_stock()) { return '' . __(' Διαθέσιμο Χρόνος Παράδοσης: 1 - 5 ημέρες', 'woocommerce') . ''; } else { return '' . __('Εξαντλημένο', 'woocommerce') . ''; } } add_shortcode('stock_status', 'stock_status_shortcode');

Symptoms:
I can't translate the stock status messages from Greek to English on the single product pages.

Questions:
How can I translate the stock status messages that appear in the single product page from a php snippet using WPML?