Plugin Directory

Changeset 1604825


Ignore:
Timestamp:
02/27/2017 09:20:36 PM (9 years ago)
Author:
MailChimp
Message:

Update to 1.1.0. Fix for opt-in status. Add support for order urls, partial refunds.

Location:
mailchimp-for-woocommerce
Files:
116 added
9 edited

Legend:

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

    r1592742 r1604825  
    1 === WooCommerce MailChimp® ===
     1=== MailChimp for WooCommerce ===
    22Contributors: ryanhungate, MailChimp
    33Tags: ecommerce,email,workflows,mailchimp
     
    2222- Segment based on purchase history
    2323- View your results and measure ROI
    24 - Grow your audience and sell more stuff with Facebook Ad Campaigns in MailChimp (New)
    2524
    2625###A note for current WooCommerce integration users
     
    5049
    5150== Changelog ==
     51= 1.1.0 =
     52* Fix for persisting opt-in status
     53* Pass order URLs to MailChimp
     54* Pass partial refund status to MailChimp
     55
    5256= 1.0.9 =
    5357* billing and shipping address support for orders
  • mailchimp-for-woocommerce/trunk/admin/class-mailchimp-woocommerce-admin.php

    r1557758 r1604825  
    674674        $store->setName($this->array_get($data, 'store_name'));
    675675        $store->setDomain(get_option('siteurl'));
    676         $store->setEmailAddress($this->array_get($data, 'campaign_from_email'));
     676
     677        // don't know why we did this before
     678        //$store->setEmailAddress($this->array_get($data, 'campaign_from_email'));
     679        $store->setEmailAddress($this->array_get($data, 'admin_email'));
     680
    677681        $store->setAddress($this->address($data));
    678682        $store->setPhone($this->array_get($data, 'store_phone'));
  • mailchimp-for-woocommerce/trunk/changelog.md

    r1588451 r1604825  
     1** 1.1.0 **
     2* Fix for persisting opt-in status
     3* Pass order URLs to MailChimp
     4* Pass partial refund status to MailChimp
     5
    16** 1.0.9 **
    27* billing and shipping address support for orders
  • mailchimp-for-woocommerce/trunk/includes/api/assets/class-mailchimp-order.php

    r1582981 r1604825  
    2525    protected $processed_at_foreign = null;
    2626    protected $cancelled_at_foreign = null;
     27    protected $order_url = null;
    2728    protected $shipping_address = null;
    2829    protected $billing_address = null;
     
    4849            'updated_at_foreign' => 'date',
    4950            'cancelled_at_foreign' => 'date',
     51            'order_url' => 'string',
    5052            'lines' => 'required|array',
    5153        );
     
    223225
    224226        return $this;
     227    }
     228
     229    /**
     230     * @param $url
     231     * @return $this
     232     */
     233    public function setOrderURL($url)
     234    {
     235        $this->order_url = $url;
     236
     237        return $this;
     238    }
     239
     240    /**
     241     * @return string
     242     */
     243    public function getOrderURL()
     244    {
     245        return $this->order_url;
    225246    }
    226247
     
    397418            'currency_code' => (string) $this->getCurrencyCode(),
    398419            'order_total' => floatval($this->getOrderTotal()),
     420            'order_url' => (string) $this->getOrderURL(),
    399421            'tax_total' => floatval($this->getTaxTotal()),
    400422            'discount_total' => floatval($this->getDiscountTotal()),
     
    420442        $singles = array(
    421443            'id', 'landing_site', 'campaign_id', 'financial_status', 'fulfillment_status',
    422             'currency_code', 'order_total', 'tax_total', 'discount_total', 'processed_at_foreign',
     444            'currency_code', 'order_total', 'order_url', 'tax_total', 'discount_total', 'processed_at_foreign',
    423445            'cancelled_at_foreign', 'updated_at_foreign'
    424446        );
  • mailchimp-for-woocommerce/trunk/includes/api/class-mailchimp-woocommerce-transform-orders.php

    r1588451 r1604825  
    9292        $order->setOrderTotal($woo->get_total());
    9393
     94        // set the order URL
     95        $order->setOrderURL($woo->get_view_order_url());
     96
    9497        // if we have any tax
    9598        $order->setTaxTotal($woo->get_total_tax());
     
    138141            $order->addItem($item);
    139142        }
     143
     144        //if (($refund = $woo->get_total_refunded()) && $refund > 0){
     145            // this is where we would be altering the submission to tell us about the refund.
     146        //}
    140147
    141148        return $order;
  • mailchimp-for-woocommerce/trunk/includes/class-mailchimp-woocommerce-service.php

    r1582981 r1604825  
    105105
    106106    /**
     107     * @param $order_id
     108     */
     109    public function onPartiallyRefunded($order_id)
     110    {
     111        if ($this->hasOption('mailchimp_api_key')) {
     112            $handler = new MailChimp_WooCommerce_Single_Order($order_id, null, null, null);
     113            $handler->partially_refunded = true;
     114            wp_queue($handler);
     115        }
     116    }
     117
     118    /**
    107119     * @return bool
    108120     */
     
    196208    {
    197209        // only update this person if they were marked as subscribed before
    198         $is_subscribed = (bool) get_user_meta($user_id, 'mailchimp_woocommerce_is_subscribed', true);
    199         wp_queue(new MailChimp_WooCommerce_User_Submit($user_id, $is_subscribed, $old_user_data));
     210        $is_subscribed = get_user_meta($user_id, 'mailchimp_woocommerce_is_subscribed', true);
     211
     212        // if they don't have a meta set for is_subscribed, we will get a blank string, so just ignore this.
     213        if ($is_subscribed === '' || $is_subscribed === null) return;
     214
     215        // only send this update if the user actually has a boolean value.
     216        wp_queue(new MailChimp_WooCommerce_User_Submit($user_id, (bool) $is_subscribed, $old_user_data));
    200217    }
    201218
  • mailchimp-for-woocommerce/trunk/includes/class-mailchimp-woocommerce.php

    r1582981 r1604825  
    330330            $this->loader->add_action('woocommerce_order_status_changed', $service, 'handleOrderStatusChanged', 2);
    331331
     332            // partially refunded
     333            $this->loader->add_action('woocommerce_order_partially_refunded', $service, 'onPartiallyRefunded', 10);
     334
    332335            // cart hooks
    333336            $this->loader->add_action('woocommerce_cart_updated', $service, 'handleCartUpdated');
  • mailchimp-for-woocommerce/trunk/includes/processes/class-mailchimp-woocommerce-single-order.php

    r1582981 r1604825  
    1616    public $landing_site;
    1717    public $is_update = false;
     18    public $partially_refunded = false;
    1819
    1920    /**
     
    7475                // transform the order
    7576                $order = $job->transform(get_post($this->order_id));
     77
     78                // if we're overriding this we need to set it here.
     79                if ($this->partially_refunded) {
     80                    $order->setFinancialStatus('partially_refunded');
     81                }
    7682
    7783                // will be the same as the customer id. an md5'd hash of a lowercased email.
  • mailchimp-for-woocommerce/trunk/mailchimp-woocommerce.php

    r1588451 r1604825  
    1717 * Plugin URI:        https://mailchimp.com/connect-your-store/
    1818 * Description:       MailChimp - WooCommerce plugin
    19  * Version:           1.0.9
     19 * Version:           1.1.0
    2020 * Author:            MailChimp
    2121 * Author URI:        https://mailchimp.com
     
    4040        'repo' => 'master',
    4141        'environment' => 'production',
    42         'version' => '1.0.9',
     42        'version' => '1.1.0',
    4343        'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
    4444    );
Note: See TracChangeset for help on using the changeset viewer.