PHP WordPress WooCommerce

WooCommerce - Switch Langauge With PDF Invoices

219 days ago

 This code allows you to switch the invoice language to the one when the order was made. This requires you to have stored the order as meta '_order_language' when the order was placed. See my other snippet for more info.

<?php

// Set the user his language
$lang = get_post_meta($this->order->id, '_order_language', true);

if (!$lang) {
    $lang = 'en';
}

do_action('wpml_switch_language', $lang);
Dylan Hoogeveen Dylan Hoogeveen