Plugin Directory

Changeset 3355528


Ignore:
Timestamp:
09/03/2025 03:03:28 PM (7 months ago)
Author:
ryanhungate
Message:

pre-release 5.6

Location:
mailchimp-for-woocommerce/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • mailchimp-for-woocommerce/trunk/CHANGELOG.txt

    r3346450 r3355528  
    11== Changelog ==
     2= 5.6 =
     3* Adds support for HPOS Data Caching
     4* Bump tmp from 0.2.1 to 0.2.4
     5* Adds support for syncing based on Mailchimp list interests with a new filter
     6* Adds support for Multi-currency with a new filter
    27= 5.5.1 =
    38* Guest checkout sync logic fix
  • mailchimp-for-woocommerce/trunk/README.txt

    r3346473 r3355528  
    88Requires PHP: 7.4
    99WC requires at least: 8.2
    10 WC tested up to: 10.0
     10WC tested up to: 10.1
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7979
    8080== Changelog ==
    81 = 5.5.1 =
    82 * Guest checkout sync logic fix
    83 * Site Performance update -  Disabled mailchimp_landing_site cookie by default.
     81= 5.6 =
     82* Adds support for HPOS Data Caching
     83* Bumps tmp from 0.2.1 to 0.2.4
     84* Adds support for syncing based on Mailchimp list interests with a new filter
     85* Adds support for Multi-currency with a new filter
  • mailchimp-for-woocommerce/trunk/blocks/package-lock.json

    r3343001 r3355528  
    2113121131    },
    2113221132    "node_modules/tmp": {
    21133       "version": "0.2.1",
    21134       "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
    21135       "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
    21136       "dev": true,
    21137       "dependencies": {
    21138         "rimraf": "^3.0.0"
    21139       },
    21140       "engines": {
    21141         "node": ">=8.17.0"
    21142       }
    21143     },
    21144     "node_modules/tmp/node_modules/rimraf": {
    21145       "version": "3.0.2",
    21146       "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
    21147       "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
    21148       "dev": true,
    21149       "dependencies": {
    21150         "glob": "^7.1.3"
    21151       },
    21152       "bin": {
    21153         "rimraf": "bin.js"
    21154       },
    21155       "funding": {
    21156         "url": "https://github.com/sponsors/isaacs"
     21133      "version": "0.2.4",
     21134      "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.4.tgz",
     21135      "integrity": "sha512-UdiSoX6ypifLmrfQ/XfiawN6hkjSBpCjhKxxZcWlUUmoXLaCKQU0bx4HF/tdDK2uzRuchf1txGvrWBzYREssoQ==",
     21136      "dev": true,
     21137      "license": "MIT",
     21138      "engines": {
     21139        "node": ">=14.14"
    2115721140      }
    2115821141    },
  • mailchimp-for-woocommerce/trunk/bootstrap.php

    r3346450 r3355528  
    313313}
    314314
     315function get_woo_session($key, $default = null)
     316{
     317    if (!function_exists('WC')) return $default;
     318
     319    if (!($woo = WC()) || empty(WC()->session)) {
     320        return $default;
     321    }
     322
     323    // not really sure why this would be the case, but if there is no session we can't get it anyway.
     324    if (!is_object($woo->session) || !method_exists($woo->session, 'get')) {
     325        return $default;
     326    }
     327
     328    return $woo->session->get($key, $default);
     329}
     330
    315331/**
    316332 * @return bool
  • mailchimp-for-woocommerce/trunk/includes/api/assets/class-mailchimp-cart.php

    r3006868 r3355528  
    1313    protected $store_id;
    1414    protected $id;
     15    protected $session_id;
    1516    protected $customer;
    1617    protected $checkout_url;
     
    3031    }
    3132
     33    public function setSessionId( $session_id ) {
     34        $this->session_id = $session_id;
     35
     36        return $this;
     37    }
     38
    3239    /**
    3340     * @return mixed
     
    104111     */
    105112    public function setCurrencyCode() {
    106         $this->currency_code = get_woocommerce_currency();
     113        $default_currency = get_woocommerce_currency();
     114        $this->currency_code = apply_filters('mailchimp_woocommerce_cart_currency_code', $default_currency, $this->session_id);
    107115
    108116        return $this;
     
    114122    public function getCurrencyCode() {
    115123        if ( empty( $this->currency_code ) ) {
    116             $this->currency_code = get_woocommerce_currency();
     124            $default_currency = get_woocommerce_currency();
     125            $this->currency_code = apply_filters('mailchimp_woocommerce_cart_currency_code', $default_currency, $this->session_id);
    117126        }
    118127
  • mailchimp-for-woocommerce/trunk/includes/api/class-mailchimp-api.php

    r3343001 r3355528  
    281281        }
    282282
    283         $data = $this->cleanListSubmission(
     283        $list_interests = apply_filters('mailchimp_sync_user_list_interests', $list_interests, $email);
     284
     285        $data = $this->cleanListSubmission(
    284286            array(
    285287                'email_type'            => 'html',
     
    287289                'status'                => $status,
    288290                'merge_fields'          => $merge_fields,
    289                 'interests'             => $list_interests,
     291                'interests'             => is_array($list_interests) ? $list_interests : array(),
    290292                'language'              => $language,
    291293                'marketing_permissions' => $gdpr_fields,
     
    347349        }
    348350
     351        $list_interests = apply_filters('mailchimp_sync_user_list_interests', $list_interests, $email);
     352
    349353        $payload = array(
    350354            'email_address'         => $email,
    351355            'status'                => $status,
    352356            'merge_fields'          => $merge_fields,
    353             'interests'             => $list_interests,
     357            'interests'             => is_array($list_interests) ? $list_interests : array(),
    354358            'language'              => $language,
    355359            'marketing_permissions' => $gdpr_fields,
     
    565569        }
    566570
    567         $data = array(
     571        $list_interests = apply_filters('mailchimp_sync_user_list_interests', $list_interests, $email);
     572
     573        $data = array(
    568574            'email_address' => $email,
    569575            'status'        => $status,
    570576            'status_if_new' => $status_if_new,
    571577            'merge_fields'  => $merge_fields,
    572             'interests'     => $list_interests,
     578            'interests'     => is_array($list_interests) ? $list_interests : array(),
    573579            'language'      => $language,
    574580        );
  • mailchimp-for-woocommerce/trunk/includes/class-mailchimp-woocommerce-hpos.php

    r3343001 r3355528  
    6262        } else {
    6363            $order_c = wc_get_order( $order_id );
    64             $order_c->update_meta_data( $meta_key, $meta_value );
    65             $order_c->save_meta_data();
     64
     65            if ($order_c) {
     66                $order_c->update_meta_data( $meta_key, $meta_value );
     67                $order_c->save_meta_data();
     68            } else {
     69                update_post_meta($order_id, $meta_key, $meta_value);
     70            }
    6671        }
    6772    }
  • mailchimp-for-woocommerce/trunk/includes/class-mailchimp-woocommerce-service.php

    r3346450 r3355528  
    285285                $language = $this->user_language ?: substr(get_locale(), 0, 2);
    286286
     287                $session_id = function_exists('WC') ? WC()->session->get_customer_id() : null;
     288
    287289                // fire up the job handler
    288                 $handler = new MailChimp_WooCommerce_Cart_Update($uid, $user_email, $this->cart, $language);
     290                $handler = new MailChimp_WooCommerce_Cart_Update($uid, $user_email, $this->cart, $language, $session_id);
    289291
    290292                // if they had the checkbox checked - go ahead and subscribe them if this is the first post.
     
    368370     * @return void
    369371     */
    370     public function handleProductUpdated( int $post_ID, WP_Post $post_after, WP_Post $post_before )
    371     {
     372    public function handleProductUpdated( int $post_ID, ?WP_Post $post_after, ?WP_Post $post_before )
     373    {
     374        if (is_null($post_after) || is_null($post_before)) {
     375            return;
     376        }
     377
    372378        if ('product' !== $post_after->post_type) {
    373379            return;
     
    551557    }
    552558
     559    public function handleProductVariationUpdated($variation_id, $product)
     560    {
     561        try {
     562            if (!mailchimp_is_configured()) {
     563                return;
     564            }
     565
     566            mailchimp_handle_or_queue(new MailChimp_WooCommerce_Single_Product_Variation($variation_id), 5);
     567        } catch (Exception $e) {
     568            mailchimp_error('update product variation', $e->getMessage());
     569        }
     570    }
     571
    553572    /**
    554573     * Fire new order and order save handling/queueing events when a shop_order post is saved.
  • mailchimp-for-woocommerce/trunk/includes/class-mailchimp-woocommerce.php

    r3343001 r3355528  
    432432            $this->loader->add_action('woocommerce_delete_coupon', $service, 'handlePostTrashed');
    433433            $this->loader->add_action('woocommerce_trash_coupon', $service, 'handlePostTrashed');
    434            
     434
     435            $this->loader->add_action('woocommerce_update_product_variation', $service, 'handleProductVariationUpdated', 10, 2);
     436
    435437            $this->loader->add_action('woocommerce_rest_delete_shop_coupon_object', $service, 'handleAPICouponTrashed', 10, 3);
    436438            $this->loader->add_action('woocommerce_rest_insert_shop_coupon_object', $service, 'handleAPICouponUpdated', 10, 3);
  • mailchimp-for-woocommerce/trunk/includes/processes/class-mailchimp-woocommerce-cart-update.php

    r3253510 r3355528  
    1313    public $id;
    1414    public $email;
     15    public $session_id;
    1516    public $previous_email;
    1617    public $cart_data;
     
    2829     * @param null $user_language
    2930     */
    30     public function __construct($uid = null, $email = null, array $cart_data = array(), $user_language = null)
     31    public function __construct($uid = null, $email = null, array $cart_data = array(), $user_language = null, $session_id = null)
    3132    {
    3233        if ($uid) {
     
    4243        if ($user_language) {
    4344            $this->user_language = $user_language;
     45        }
     46
     47        if ($session_id) {
     48            $this->session_id = $session_id;
    4449        }
    4550
     
    119124            $cart = new MailChimp_WooCommerce_Cart();
    120125            $cart->setId($this->id);
     126            $cart->setSessionId($this->session_id);
    121127            $cart->setCheckoutUrl($checkout_url);
    122128            $cart->setCurrencyCode();
  • mailchimp-for-woocommerce/trunk/languages/mc-woocommerce-newsletter.pot

    r3141736 r3355528  
    1 # Copyright (C) 2024
     1# Copyright (C) 2025
    22# This file is distributed under the same license as the  package.
    33msgid ""
     
    55"Project-Id-Version: \n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/blocks\n"
    7 "POT-Creation-Date: 2024-07-30 14:12:30+00:00\n"
     7"POT-Creation-Date: 2025-08-20 08:03:29+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=utf-8\n"
    1010"Content-Transfer-Encoding: 8bit\n"
    11 "PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n"
     11"PO-Revision-Date: 2025-MO-DA HO:MI+ZONE\n"
    1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    1313"Language-Team: LANGUAGE <LL@li.org>\n"
  • mailchimp-for-woocommerce/trunk/mailchimp-woocommerce.php

    r3346450 r3355528  
    1717 * Plugin URI:        https://mailchimp.com/connect-your-store/
    1818 * Description:       Connects WooCommerce to Mailchimp to sync your store data, send targeted campaigns to your customers, and sell more stuff.
    19  * Version:           5.5.1
     19 * Version:           5.6
    2020 * Author:            Mailchimp
    2121 * Author URI:        https://mailchimp.com
     
    2828 * Tested up to: 6.8
    2929 * WC requires at least: 8.2
    30  * WC tested up to: 10
     30 * WC tested up to: 10.1
    3131 */
    3232
  • mailchimp-for-woocommerce/trunk/public/js/mailchimp-woocommerce-public.js

    r3209992 r3355528  
    3939        if (!mailchimp_cart.valueEmail(b) || mailchimp_submitted_email === b) { return false; }
    4040        mailchimp_cart.setEmail(b);
    41         console.log(b);
    42         console.log(mailchimp_cart);
     41
    4342        var c = mailchimp_public_data.ajax_url + "?action=mailchimp_set_user_by_email";
    4443        var d = new XMLHttpRequest;
    4544        d.open("POST", c, !0);
    4645        d.onload = function () {
    47             console.log(d);
    4846            var successful = d.status >= 200 && d.status < 400;
    4947            var msg = successful ? "mailchimp.handle_billing_email.request.success" : "mailchimp.handle_billing_email.request.error";
     
    187185
    188186mailchimpReady(function () {
    189 
    190     console.log('mailchimp ready');
    191187    // if they've told us we can't do this - we have to honor it.
    192188    if (!mailchimp_public_data.allowed_to_set_cookies) return;
Note: See TracChangeset for help on using the changeset viewer.