Plugin Directory

Changeset 3361673


Ignore:
Timestamp:
09/15/2025 10:30:16 AM (6 months ago)
Author:
mailerlite
Message:

updated to 3.0.8

Location:
woo-mailerlite/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • woo-mailerlite/trunk/admin/WooMailerLiteAdmin.php

    r3339434 r3361673  
    5353            if ($response->status === 401) {
    5454                $falseApi = true;
    55                 WooMailerLiteOptions::deleteAll();
     55//                WooMailerLiteOptions::deleteAll();
    5656            } else {
    5757                WooMailerLiteCache::set('valid_api', true, 86400);
  • woo-mailerlite/trunk/admin/controllers/WooMailerLiteAdminWizardController.php

    r3344677 r3361673  
    9191        ]);
    9292
    93         if (!$this->apiClient()->isReWrite() && !$this->validateClassicConsumerKeys($this->request['consumerKey'], $this->request['consumerSecret'])) {
    94             return $this->response(['message' => 'Invalid consumer key or secret'], 400);
    95         }
     93        // temp removing checking keys
     94//        if (!$this->apiClient()->isReWrite() && !$this->validateClassicConsumerKeys($this->request['consumerKey'], $this->request['consumerSecret'])) {
     95//            return $this->response(['message' => 'Invalid consumer key or secret'], 400);
     96//        }
    9697
    9798        if (!WooMailerLiteOptions::get('group') || (!empty(WooMailerLiteOptions::get('group', [])) && WooMailerLiteOptions::get('group')['id'] != $this->validated['group'])) {
  • woo-mailerlite/trunk/includes/WooMailerLite.php

    r3339434 r3361673  
    7171        $this->define_public_hooks();
    7272        $this->setupWooMailerLite();
    73         $this->handleUpgrade();
     73//        $this->handleUpgrade();
    7474    }
    7575    /**
  • woo-mailerlite/trunk/includes/common/traits/WooMailerLiteResources.php

    r3338878 r3361673  
    4848        switch ($this->resource) {
    4949            case 'WooMailerLiteProduct':
     50                if (isset($this->args['id'])) {
     51                    $this->args['include'] = [$this->args['id']];
     52                    unset($this->args['id']);
     53                }
    5054                $this->args = array_merge([
    5155                    'limit' => -1,
  • woo-mailerlite/trunk/includes/controllers/WooMailerLiteOrderController.php

    r3348600 r3361673  
    2121            }
    2222            $cart = WooMailerLiteCart::where('email', $order->get_billing_email())->first();
    23 
    24             if (!$cart || !$customer) {
     23            if (!$cart) {
     24                $cart = WooMailerLiteCart::where('hash', WooMailerLiteSession::getMLCartHash())->first();
     25                if ($cart instanceof WooMailerLiteCart) {
     26                    $cart->update([
     27                        'email' => $order->get_billing_email(),
     28                    ]);
     29                }
     30            }
     31            if (!$cart && !$customer) {
    2532                return true;
    2633            }
     
    123130
    124131            } else {
    125                 $response = $this->apiClient()->syncOrder(WooMailerLiteOptions::get('shopId'), $orderId, $orderCustomer, $cartData, $order->get_status(), $order->get_total(), $order->get_date_created()->format('Y-m-d H:i:s'));
     132                $date = null;
     133                if ($order->get_date_created()) {
     134                    $date = $order->get_date_created()->format('Y-m-d H:i:s');
     135                }
     136                $response = $this->apiClient()->syncOrder(WooMailerLiteOptions::get('shopId'), $orderId, $orderCustomer, $cartData, $order->get_status(), $order->get_total(), $date);
    126137            }
    127138            if (isset($response) && $response->success) {
    128139                $order->add_meta_data('_woo_ml_order_data_submitted', true);
    129                 if (in_array($order->get_status(), ['wc-completed', 'wc-processing','completed','processing'])) {
    130                     $cart->delete();
     140                if (in_array($order->get_status(), ['wc-completed', 'wc-processing','completed','processing']) && !empty($cart)) {
     141                    if ($cart instanceof WooMailerLiteCart) {
     142                        $cart->delete();
     143                    }
    131144                }
    132145                if ($this->apiClient()->isClassic()) {
  • woo-mailerlite/trunk/includes/models/WooMailerLiteCustomer.php

    r3338878 r3361673  
    2323        'zip',
    2424        'last_order_id',
    25         'last_order'
     25        'last_order',
    2626    ];
    2727
     
    3434        $prefix = db()->prefix;
    3535
    36         $query = static::builder()->select("wp_wc_customer_lookup.customer_id,
    37         wp_wc_customer_lookup.email,
    38         max(wp_wc_order_stats.order_id) AS last_order_id,
    39         max(wp_wc_order_stats.date_created) AS last_order,
    40         count(DISTINCT wp_wc_order_stats.order_id) AS orders_count,
    41         sum(wp_wc_order_stats.total_sales) AS total_spent,
     36        $query = static::builder()->select("
     37        {$prefix}wc_customer_lookup.customer_id,
     38        {$prefix}wc_customer_lookup.email,
     39        max({$prefix}wc_order_stats.order_id) AS last_order_id,
     40        max({$prefix}wc_order_stats.date_created) AS last_order,
     41        count(DISTINCT {$prefix}wc_order_stats.order_id) AS orders_count,
     42        sum({$prefix}wc_order_stats.total_sales) AS total_spent,
    4243        CASE WHEN (
    4344                        SELECT
  • woo-mailerlite/trunk/public/js/woo-mailerlite-public.js

    r3348600 r3361673  
    77    let checkboxAdded = false;
    88    let mailerLiteCheckoutBlockActive = null;
    9 
    10     if (document.querySelector('[data-block-name="woocommerce/checkout"]')) {
    11         window.mailerlitePublicJsCaptured = false;
    12     } else {
    13         window.mailerlitePublicJsCaptured = true;
    14     }
     9    let listeningEvents = false;
     10
     11
     12    // temporarily forcefully picking this js not blocks one
     13    window.mailerlitePublicJsCaptured = true;
     14    // if (document.querySelector('[data-block-name="woocommerce/checkout"]')) {
     15    //     window.mailerlitePublicJsCaptured = false;
     16    // } else {
     17    //     window.mailerlitePublicJsCaptured = true;
     18    // }
    1519
    1620    if (wooMailerLitePublicData.checkboxSettings.enabled && document.body.classList.contains('woocommerce-checkout')) {
     
    4852        }
    4953
    50         if (checkboxAdded || (mailerLiteCheckoutBlockActive !== null && mailerLiteCheckoutBlockActive)) {
     54        if (listeningEvents && (checkboxAdded || (mailerLiteCheckoutBlockActive !== null && mailerLiteCheckoutBlockActive))) {
    5155            return false;
    5256        }
     
    114118
    115119        if (email !== null) {
     120            listeningEvents = true;
    116121            email.addEventListener('change', (event) => {
    117122                validateMLSub(event);
     
    180185                    signup: accept_marketing,
    181186                    language: wooMailerLitePublicData.language,
    182                     name: firstName.value ?? '',
    183                     last_name: lastName.value ?? '',
     187                    name: firstName?.value ?? '',
     188                    last_name: lastName?.value ?? '',
    184189                    cookie_mailerlite_checkout_token:getCookie('mailerlite_checkout_token')
    185190                }
  • woo-mailerlite/trunk/readme.txt

    r3348600 r3361673  
    66Tested up to: 6.8.2
    77Requires PHP: 7.2.5
    8 Stable tag: 3.0.7
     8Stable tag: 3.0.8
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    8585== Changelog ==
    8686
     87= 3.0.8 (15th September 2025) =
     88* Improved cart synchronization and updates
     89* Minor bug fixes and performance improvements
     90
    8791= 3.0.7 (22nd August 2025) =
    8892* Bug fixes and improvements
  • woo-mailerlite/trunk/woo-mailerlite.php

    r3348600 r3361673  
    1616 * Plugin URI:        https://wordpress.org/plugins/woo-mailerlite/
    1717 * Description:       Official MailerLite integration for WooCommerce. Track sales and campaign ROI, import products details, automate emails based on purchases and seamlessly add your customers to your email marketing lists via WooCommerce's checkout process.
    18  * Version:           3.0.7
     18 * Version:           3.0.8
    1919 * Author:            MailerLite
    2020 * Author URI:        https://mailerlite.com
     
    4040 * Update when you release new versions.
    4141 */
    42 define( 'WOO_MAILERLITE_VERSION', '3.0.7' );
     42define( 'WOO_MAILERLITE_VERSION', '3.0.8' );
    4343
    4444define('WOO_MAILERLITE_ASYNC_JOBS', false);
Note: See TracChangeset for help on using the changeset viewer.