Last active
January 6, 2020 11:34
-
-
Save xadapter/8ef18e259da5fe2fb0327973dfb6f387 to your computer and use it in GitHub Desktop.
Translate shipment tracking message with Polylang Pro and WooCommerce Shipment Tracking Plugin: https://www.pluginhive.com/product/woocommerce-shipment-tracking-pro/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('wf_custom_tracking_message', 'update_tracking_message', 10, 3); | |
function update_tracking_message($current_msg, $language, $order) { | |
global $wpdb; | |
$qry = "SELECT term_taxonomy_id FROM {$wpdb->prefix}term_relationships WHERE object_id = $order->ID ORDER BY object_id DESC"; | |
$values = $wpdb->get_results($qry, ARRAY_A); | |
$post_lang_choice = 'en'; | |
if (!empty($values)) { | |
$land_id = $values[0]['term_taxonomy_id']; | |
$qryl = "SELECT slug FROM {$wpdb->prefix}terms WHERE term_id = $land_id "; | |
$valuesl = $wpdb->get_results($qryl, ARRAY_A); | |
if (!empty($valuesl)) | |
$post_lang_choice = $valuesl[0]['slug']; | |
} | |
if ($post_lang_choice == 'fr') { | |
//change your language here if needed, for German can use 'de' | |
return "Votre commande a été expédiée le [DATE] via [SERVICE]. Pour suivre les envois, veuillez suivre le lien correspondant aux numéros d'expédition [ID]"; | |
} else { | |
return "Your order was shipped on [DATE] via [SERVICE]. To track shipment, please follow the link of ID(s) [ID]"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment