Sauter la navigation

Marqué : 

Ce sujet contient 0 réponse, a 0 voix.

Dernière mise à jour par christosK-16 Il y a 4 semaines.

Assisté par: Noman.

Auteur Articles
décembre 23, 2024 à 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?