Factory.php
4 weeks ago
Helper.php
4 weeks ago
MulticurrencyHooks.php
4 weeks ago
class-wcml-pip.php
2 years ago
class-wcml-pip.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | use WCML\Compatibility\WcPip\Helper; |
| 4 | |
| 5 | class WCML_Pip implements \IWPML_Action { |
| 6 | |
| 7 | public function add_hooks() { |
| 8 | add_filter( 'wcml_send_email_order_id', [ $this, 'wcml_send_email_order_id' ] ); |
| 9 | add_action( 'wc_pip_print', [ $this, 'print_invoice_language' ], 10, 2 ); |
| 10 | } |
| 11 | |
| 12 | public function wcml_send_email_order_id( $order_id ) { |
| 13 | $pip_order_id = Helper::getPipOrderId(); |
| 14 | |
| 15 | if ( $pip_order_id ) { |
| 16 | $order_id = $pip_order_id; |
| 17 | } |
| 18 | |
| 19 | return $order_id; |
| 20 | } |
| 21 | |
| 22 | public function print_invoice_language( $type, $order_id ) { |
| 23 | $order_language = WCML_Orders::getLanguage( $order_id ); |
| 24 | |
| 25 | if ( $order_language ) { |
| 26 | do_action( 'wpml_switch_language', $order_language ); |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 |