• Resolved mark0x

    (@mark0x)


    Hi,

    Sorry if this has been discussed elsewhere, I searched for a while but could not find anything to help me.

    I have created an offline webapp which takes orders at outdoor exhibitions and then later when internet is available, submits them to a database and then a PHP script uses the WooCommerce API to add the orders to the shop. We have a field to log if the user wants to join the mailing list. How can I submit an order via the WooCommerce API and indicate that the user wants to join the mailing list? Up to now all these people on our Mailchimp account are marked as transactional only. Also, how can I mark these existing transactional only as subscribed on Mailchimp? I tried re-importing them via CSV as subscribed but they’re still marked as transactional only.

    Thank you for your help
    Mark

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Jordan Rich

    (@builtbyjordan)

    Hey there,

    Good news! Totally possible.

    When your script is talking to the WooComerce API. It simply has to update either the User Meta or the Post Meta for orders

    update_user_meta($user_id, 'mailchimp_woocommerce_is_subscribed', true);

    update_post_meta($order_id, 'mailchimp_woocommerce_is_subscribed', true);

    To give just a bit of background the plugin uses a custom field on orders to specify if a customer is subscribed or not. Name: mailchimp_woocommerce_is_subscribed

    Thanks again for writing in.

    Thread Starter mark0x

    (@mark0x)

    Hi Jordan,

    Thanks for your response. Since I was going back over old orders (guest orders), I found that in order to get the Mailchimp plugin to actually notice the meta change and then update the subscriber on Mailchimp I had to manually call the onOrderSave function of MailChimp_Service too.

    $mailchimp_service = MailChimp_Service::instance();
    $mailchimp_service->onOrderSave($order_id);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding subscribers to mailchimp via programmatically created orders’ is closed to new replies.