PluginProbe
MailerLite – WooCommerce integration / 3.1.17
MailerLite – WooCommerce integration v3.1.17
3.1.27 3.1.25 3.1.26 3.1.24 3.1.23 3.1.22 3.1.21 3.1.20 3.1.19 3.1.18 3.1.17 3.1.16 3.1.15 1.8.7 1.8.8 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 All 148 releases
woo-mailerlite / includes / WooMailerLiteSession.php

WooMailerLiteSession.php in MailerLite – WooCommerce integration 3.1.17, at includes/WooMailerLiteSession.php

54 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class WooMailerLiteSession {
4
5 public static function get()
6 {
7 return WC()->session;
8 }
9
10 public static function set($key, $value)
11 {
12 WC()->session->set($key, $value);
13 }
14
15 public static function cart()
16 {
17 return json_encode(WC()->cart->get_cart());
18 }
19
20 public static function customer()
21 {
22 return WC()->get_customer();
23 }
24
25 public static function billingEmail()
26 {
27 $customer = WC()->cart->get_customer();
28 return $customer->get_billing_email() ?: $customer->get_email();
29 }
30
31 public static function getMLCustomer()
32 {
33 return WC()->session->get('woo_mailerlite_customer_data');
34 }
35
36 public static function getMLCartHash()
37 {
38 if (WC()->session) {
39 return WC()->session->get('woo_mailerlite_cart_hash');
40 }
41 return null;
42 }
43
44 public static function getMlCheckbox()
45 {
46 return WC()->session->get('woo_mailerlite_checkbox') ?? false;
47 }
48
49 public static function getMLCartStageCacheKey()
50 {
51 return sprintf('woo_ml_cart_stage:%s', self::getMLCartHash());
52 }
53 }
54