| @@ -29,8 +29,9 @@ | ||
| 29 | 29 | * @return true |
| 30 | 30 | */ |
| 31 | 31 | public function handleCartUpdated() |
| 32 | 32 | { |
| 33 | + WooMailerLiteLanguageService::capture(); | |
| 33 | 34 | WooMailerLiteSession::set('woo_mailerlite_cart_hash', WC()->session->get_customer_id()); |
| 34 | 35 | $cart = WooMailerLiteCart::where('hash', WooMailerLiteSession::getMLCartHash())->first(); |
| 35 | 36 | $data = WooMailerLiteSession::cart(); |
| 36 | 37 | $data = json_decode($data, true); |
| @@ -75,8 +76,9 @@ | ||
| 75 | 76 | * @return void |
| 76 | 77 | */ |
| 77 | 78 | public function handleCheckoutPage() |
| 78 | 79 | { |
| 80 | + WooMailerLiteLanguageService::capture(); | |
| 79 | 81 | if (is_user_logged_in()) { |
| 80 | 82 | $this->sendCart(); |
| 81 | 83 | } |
| 82 | 84 | } |
| @@ -101,8 +103,10 @@ | ||
| 101 | 103 | if (!WooMailerLiteSession::getMLCartHash()) { |
| 102 | 104 | $this->handleCartUpdated(); |
| 103 | 105 | } |
| 104 | 106 | |
| 107 | + WooMailerLiteLanguageService::capture(); | |
| 108 | + | |
| 105 | 109 | WooMailerLiteSession::set('woo_mailerlite_customer_data', ['customer' => $_POST, 'cart' => WC()->session->get( 'woo_mailerlite_cart_hash')]); |
| 106 | 110 | // find the cart by cart id |
| 107 | 111 | $cart = WooMailerLiteCart::where('hash', WooMailerLiteSession::getMLCartHash())->first(); |
| 108 | 112 | |
| @@ -172,12 +176,9 @@ | ||
| 172 | 176 | }, |
| 173 | 177 | ARRAY_FILTER_USE_BOTH |
| 174 | 178 | ); |
| 175 | 179 | |
| 176 | - if (isset($checkoutData['language'])) { | |
| 177 | - $orderCustomer['subscriber_fields']['subscriber_language'] = $checkoutData['language']; | |
| 178 | - $orderCustomer['subscriber_fields']['language'] = $checkoutData['language']; | |
| 179 | - } | |
| 180 | + $orderCustomer['subscriber_fields'] = WooMailerLiteLanguageService::applyTo($orderCustomer['subscriber_fields']); | |
| 180 | 181 | |
| 181 | 182 | $orderCart = [ |
| 182 | 183 | 'resource_id' => (string)$checkoutData['id'], |
| 183 | 184 | 'checkout_url' => $checkoutData['abandoned_checkout_url'], |