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?
Gestione del consenso per i cookie
Utilizziamo i cookie per ottimizzare il nostro sito web e i nostri servizi.
Il tuo consenso ci permette di elaborare dati come il comportamento di navigazione.
Il mancato consenso potrebbe compromettere alcune funzionalità.
Funzionale
Sempre attivo
Necessario affinché il nostro sito web funzioni e comunichi correttamente.
Preferenze
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistiche
Li utilizziamo per analizzare le statistiche del nostro sito.
Le informazioni raccolte sono completamente anonime. L'archiviazione tecnica o l'accesso che viene utilizzato esclusivamente per scopi statistici anonimi. Senza un mandato, la conformità volontaria da parte del tuo fornitore di servizi Internet o altri registri di terzi, le informazioni memorizzate o recuperate per questo scopo da sole non possono generalmente essere utilizzate per identificarti.
Marketing
Questi cookie tracciano la tua navigazione per fornirti annunci pubblicitari pertinenti.