Giter Site home page Giter Site logo

mailchimp-commerce's People

Contributors

diewy avatar pieterxjan avatar stenvdb avatar tam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mailchimp-commerce's Issues

Order syncing fails if no address2 is provided

Mailchimp expects a string in the address2 field, but the plugin sends null if address2 is empty:

Create: {"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"4975bb66-4875-4fee-8162-fbace4f24a78","errors":[{"field":"customer.address.address2","message":"Schema describes string, NULL found instead"},{"field":"shipping_address.address2","message":"Schema describes string, NULL found instead"},{"field":"billing_address.address2","message":"Schema describes string, NULL found instead"}]}

Syncing orders not working

I am getting the following error as response to the failed queue task:
Call to a member function getProduct() on null

All my products have synced successfully, but non of the carts seem to sync. I've also checked the store has an address filled in + orders have a return url. Anything else I can look into?

Syncing Orders to Mailchimp error

I have the majority of my orders synced to the mailchimp account, but there seems to be a recurring issue with the plugin trying to sync incomplete orders. In the queue manager, I am getting this error multiple times.

{
    "orderIds": [
        "10326"
    ],
    "description": null
}

The order with that ID is in fact an Active Cart, and not a complete order, so it should not be trying to sync that order yet.

Is this plugin abandoned?

There seems to be zero activity from the devs here and issues outstanding for over a year with no response.

Syncing Orders to Mailchimp : Failed

I just installed the plugin, added my API key, selected my list, and created and set my opt-in lightswitch. When I try to sync orders, it says it failed but doesn't give me any other information as to what the problem may be. Any ideas? Thanks!

https://cl.ly/765db5d6225b

Syncing promotions is broken. enabled key value need to be boolean

This endpoint : ecommerce/stores/{store_id}/promo-rules
Params: enabled

Need to be boolean. This crash because craft\commerce\models\Discount->enabled return a string and Mailchimp API claims that the type should be a boolean.

Here my fix:
/src/craftCMS/vendor/ether/mailchimp-commerce/src/services/PromosService.php

private function _buildPromoData($promoId){
...
$data = [
            'id' => (string) $promo->id,
            'title' => $promo->name,
            'description' => $promo->description ?: $promo->name,
            'amount' => (float) $amount,
            'type' => $type,
            'target' => $target,
            'enabled' => filter_var($promo->enabled, FILTER_VALIDATE_BOOLEAN),
            'created_at_foreign' => $promo->dateCreated->format('c'),
            'updated_at_foreign' => $promo->dateUpdated->format('c'),
        ];
...
}

filter_var($promo->enabled, FILTER_VALIDATE_BOOLEAN)

Fix Composer 2 compatibility

When installing this plugin with Composer 1, the following deprecation notice is output:

Deprecation Notice: Class ether\mc\base\MailchimpProduct located in ./vendor/ether/mailchimp-commerce/src/base/MailChimpProduct.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0.

Composer 2 was released on October 24, and is now the default version that will be installed, so it’s critical that this gets resolved ASAP, or people will start getting Class not found errors.

To fix, run the following command:

> git mv src/base/MailChimpProduct.php src/base/MailchimpProduct.php

Then commit your change and tag a new release.

(Note that you must use the git mv command, as Git tends to not notice case-sensitive file renames otherwise.)

Question regarding syncing orders and what this plugin *does*

I was under the impression that the plugin sent order data to Mailchimp which allowed Mailchimp to show.

I've had issues syncing orders but have overcome these. Everything now syncs up and email addresses are added to the Mailchimp list when an order is placed.

However after much hair pulling I'm unable to get any actual order/revenue data to show on the Mailchimp dashboard.

Am I correct in thinking that the order data sent by the plugin to Mailchimp should be shown on the Mailchimp dashboard?

Syncing issue

I have setup this plugin and it has been working for a few days, however I am now running into an issue where in the queue the syncing fails and I get the following error message:

2020-07-15 10:38:15 [-][1][-][error][mailchimp-commerce] Create: {"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Resource Not Found","status":404,"detail":"The requested resource could not be found.","instance":"a81f63f8-bd59-4c6b-8d70-909452cf3156"}

This plugin has repeatedly stopped working after periods of working, and it's causing real issues now, I've had to disconnect and reconnect the store many times, and after a short while it can keep breaking. It may be related to making changes on localhost and pushing to live, however I've checked that the listID on my project config in all environments is correct, and I've disabled syncing for every environment apart from production.

If you have any insights into what's causing this, it would be a great help

UPDATE

I have done some more digging, and I believe the issue lies with the Project Config plugin settings 'storeId'.

When I connect the list on my development environment, it will create a store on Mailchimp, and add that storeId to the plugin settings. When pushing to staging and syncing project config, this will overwrite the store settings on production.

Would it be possible to get the plugin working properly with craft project config? Perhaps storing the storeId settings in a database table could work, as this won't sync between environments?

Syncing products: failed

When trying to sync products to Mailchimp, the job fails. This is what the queue.log says:

{"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Resource Not Found","status":404,"detail":"The requested resource could not be found.","instance":"deada5a7-1384-421f-840a-348459e26102"}

After a bit of debugging, I can see the correct product data being sent to Mailchimp in a post request.

The customer has a free account (it's not upgraded yet), could that be the problem. Do Mailchimp's Commerce features require a paid account?

Syncing Promos to Mailchimp Failed

We haven't been able to get the Promotions to sync to Mailchimp. Seeing the following in the Mailchimp API response:

The resource submitted could not be validated. For field-specific details, see the 'errors' array.

Integrity constraint violation when syncing order

We've been having an elusive, recurring issue in our Craft Commerce store where amongst thousands of successful orders, the occasional few will have an issue where our custom code that should fire on EVENT_AFTER_ORDER_PAID does not get executed, so the order does not get sent to our shipping partner.

The common thread that I have found is that the following error shows in the logs right after our custom code for EVENT_AFTER_COMPLETE_ORDER executes:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6326993' for key 'PRIMARY'
The SQL being executed was: INSERT INTO `craft_mc_orders_synced` (`orderId`, `isCart`, `lastSynced`) VALUES (6326993, 0, '2021-01-21 05:58:55')

Whatever is causing this error, it's preventing a small number of our orders to not get shipped out, until we catch the error.

Any idea why this might be happening, how to prevent it, or at the very least prevent it from derailing the rest of the events that should fire after it?

Thanks!

We're on Mailchimp-Commerce v1.2.2 and Craft 3.4.25.

Error syncing products that use an Image transformation

When trying to sync products that have an image transformation (even if you then remove the field mapping for the transform) a PHP error prevents the sync.

array_values() expects parameter 1 to be array, object given

The problem lies in line 449 of ProductsService.php. Which is

$transform = Craft::$app->getAssetTransforms()->getTransformByUid($transform);

For the moment I have worked around it by hardcoding a transform array into the plugin (as per the default you already have in there.

Guzzle dependency too old to allow installation

I'm trying to install mailchimp-commerce on a recently upgraded site. I've had to remove it in order to do the updates due to the guzzle dependency being locked at 6.3.3

The upgraded site has Guzzle 7.x installed and so I am unable to install the plugin.

Would it be possible to get this dependency updated so the plugin could be used?

I'm using Craft 3.6.13 with Commerce 3.3.1

Sync Products: Verbb Events translation issue

Events from the Verbb Events plugin are registered as a custom MailChimp Product by your plugin. However, I wasn't seeing them showing up as an option to Sync in the Products section on the Sync tab.

So I investigated further and determined the following exception was being thrown when MailChimp E-Commerce attempts to register Events as a custom product type:

yii\base\InvalidConfigException#1
(
    [*:message] => 'Unable to locate message source for category \'events\'.'
    [Exception:string] => ''
    [*:code] => 0
    [*:file] => '.../vendor/yiisoft/yii2/i18n/I18N.php'
    [*:line] => 201
    [Exception:trace] => [
        0 => [
            'file' => '.../vendor/yiisoft/yii2/i18n/I18N.php'
            'line' => 89
            'function' => 'getMessageSource'
            'class' => 'yii\\i18n\\I18N'
            'type' => '->'
            'args' => [
                0 => 'events'
            ]
        ]
        1 => [
            'file' => '.../vendor/craftcms/cms/src/i18n/I18N.php'
            'line' => 327
            'function' => 'translate'
            'class' => 'yii\\i18n\\I18N'
            'type' => '->'
            'args' => [
                0 => 'events'
                1 => 'Events'
                2 => []
                3 => 'en-AU'
            ]
        ]
        2 => [
            'file' => '.../vendor/yiisoft/yii2/BaseYii.php'
            'line' => 526
            'function' => 'translate'
            'class' => 'craft\\i18n\\I18N'
            'type' => '->'
            'args' => [
                0 => 'events'
                1 => 'Events'
                2 => []
                3 => 'en-AU'
            ]
        ]
        3 => [
            'file' => '.../vendor/ether/mailchimp-commerce/src/services/ChimpService.php'
            'line' => 113
            'function' => 't'
            'class' => 'yii\\BaseYii'
            'type' => '::'
            'args' => [
                0 => 'events'
                1 => 'Events'
            ]
        ]
        4 => [
            'file' => '.../vendor/ether/mailchimp-commerce/src/MailchimpCommerce.php'
            'line' => 112
            'function' => 'getProducts'
            'class' => 'ether\\mc\\services\\ChimpService'
            'type' => '->'
            'args' => []
        ]
        5 => [
            'file' => '.../vendor/yiisoft/yii2/base/BaseObject.php'
            'line' => 109
            'function' => 'init'
            'class' => 'ether\\mc\\MailchimpCommerce'
            'type' => '->'
            'args' => []
        ]
        6 => [
            'file' => '.../vendor/yiisoft/yii2/base/Module.php'
            'line' => 158
            'function' => '__construct'
            'class' => 'yii\\base\\BaseObject'
            'type' => '->'
            'args' => [
                0 => [
                    'name' => 'Mailchimp Commerce'
                    'version' => '1.1.10'
                    'schemaVersion' => '1.0.2'
                    'description' => 'Mailchimp integration with Craft Commerce'
                    'developer' => 'Ether'
                    'developerUrl' => 'https://ethercreative.co.uk'
                    'documentationUrl' => 'https://github.com/ethercreative/mailchimp-commerce/blob/master/README.md'
                    'packageName' => 'ether/mailchimp-commerce'
                    'isInstalled' => true
                    'edition' => 'standard'
                    'settings' => [
                        'disableSyncing' => false
                        'apiKey' => 'XXXXX'
                        'storeId' => 'XXXXX'
                        'listId' => '1deaf7b5a6'
                        'optInField' => null
                        'shippedStatusHandle' => 'shipped'
                        'thumbnailTransform' => null
                        'imageTransform' => null
                        'promoRedemptionUrl' => null
                        'abandonedCartRestoreUrl' => null
                        'expiredCartError' => 'Your cart has expired!'
                        'completedCartError' => 'You\'ve already completed this order!'
                        'cartRestoredNotice' => 'Your cart has been restored!'
                    ]
                ]
            ]
        ]
        ...

Seems like somehow the translation category 'events' is not bootstrapped yet by Craft.

In case it's important, my Craft 3 site is using the 'en-au' locale. I tested changing it to the 'en' locale, but that did not resolve the issue.

I'm running latest Craft 3, with latest Commerce and Events plugin.

Hopefully you can reproduce this.

Some questions about the plugin

I have several questions about the plugin:

Are there more docs somewhere?

How can users opt-in for the Newsletter?
How does the template code look like?

Is there a possibility to add subscribers to specific groups of a mailchimp audience?

And I think there's a bug with synching:
When viewing the synched items, the images don't display because it sets the siteUrl twice:
´https://mysite.com/https:mysite.com/documents/images/…´

any help appreciated!

cheers
stefan

Mailchimp Campaign ID

Store the mc_cid on restore against the restored order, then send the ID along with the order on update (we should overwrite any existing ID so we only have the latest).

Support for Donations

Craft has a build in donation functionality but if an order has a donation in it the mailchimp sync will fail and you will be returned to the payment screen again with the following error (even though the order goes through):

Calling unknown method: craft\commerce\elements\Donation::getProduct()

The problem is that the Donation doesn't have any getProduct() function.

I found this call in two files in the plugin:

OrdersService.php > _getProduct($purchasable):
....
return $purchasable->getProduct();

And

ProductsService.php > _getProductFromVariant($purchasable):
...
return $purchasable->getProduct();

Opt-in during checkout

I know I'm missing something simple, but I cannot get the opt-in lightswitch to turn on during checkout. I have a custom field subscribeToNewsletter that defaults to off and has been added to my order fields. In my templates, I ask for the user to opt-in when they enter their email address. My template code is as follows:

<form method="post">
  <input type="hidden" name="action" value="commerce/cart/update-cart">
  {{ csrfInput() }}

  <label for="email">E-mail</label>
  <input id="email" type="email" value="{{ cart.email }}" name="email">

<label>
  <input type="checkbox" name="fields[subscribeToNewsletter]" value="1" checked>
  Subscribe to updates, promotions and news.
</label>

  <button type="submit">Confirm E-mail</button>
</form>

Thanks in advance for some guidance.

PHP warning if no store location is defined

On a Commerce installation without a store location, syncing the store to Mailchimp leads to a PHP warning on line 44 of helpers/AddressHelper.php, because no country is defined.

Campaign revenue tracking

Hi,

While the syncing of data seems to work OK, we can't see any revenue figures within MailChimp against campaigns or abandoned cart. Does the plugin handle this and, if not, is it on the roadmap?

Thanks - Joe

Issue with allowAdminChanges = false

When allowAdminChanges is set to false, you still get redirected by default to the /connect template as index route. Which results in a template not found error if allowAdminChanges = false.

[FR] Syncing orders as separate, or batched queue tasks rather than 1 huge task.

It feels like syncing orders a single queue task might be a bit of an issue for those sites with a lot of legacy orders. Despite the sync process being a queue it's still going to lock things up while it processes all the orders.

Would it be possible to create a separate queue task for each order - or even batch them into chunks to avoid a situation where tens of thousands of orders need to sync before the next task can run?

Error trying to Sync some Products

We've got the Store Sync'd, in as much as some products are appearing in Mailchimp and new Orders are getting to Mailchimp too. Our issue is that not all of the Products are making their way there. When I try to sync a specific Product Type we get the following in the queue.log...

2019-08-16 11:01:14 - error - mailchimp-commerce
{"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"15019056-dcd0-4318-ade5-94dc11d4c379","errors":[{"field":"url","message":"Schema describes string, NULL found instead"}]}
2019-08-16 11:01:14 - error - craft\queue\QueueLogBehavior::afterError
 [4668] Syncing Products to Mailchimp (attempt: 1) - Error (time: 22.666s): Failed to sync product
2019-08-16 11:01:14 - error - craft\db\QueryAbortedException
craft\db\QueryAbortedException: Failed to sync product in /.../.../.../.../.../vendor/ether/mailchimp-commerce/src/jobs/SyncProducts.php:55
Stack trace:
#0 /.../.../.../.../.../vendor/yiisoft/yii2-queue/src/Queue.php(214): ether\mc\jobs\SyncProducts->execute(Object(craft\queue\Queue))
#1 /.../.../.../.../.../vendor/yiisoft/yii2-queue/src/cli/Queue.php(147): yii\queue\Queue->handleMessage('4668', 'O:26:"ether\\mc\\...', '300', 1)
#2 /.../.../.../.../.../vendor/craftcms/cms/src/queue/Queue.php(96): yii\queue\cli\Queue->handleMessage('4668', 'O:26:"ether\\mc\\...', '300', 1)
#3 /.../.../.../.../.../vendor/craftcms/cms/src/controllers/QueueController.php(86): craft\queue\Queue->run()
#4 [internal function]: craft\controllers\QueueController->actionRun()
#5 /.../.../.../.../.../vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#6 /.../.../.../.../.../vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#7 /.../.../.../.../.../vendor/craftcms/cms/src/web/Controller.php(187): yii\base\Controller->runAction('run', Array)
#8 /.../.../.../.../.../vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('run', Array)
#9 /.../.../.../.../.../vendor/craftcms/cms/src/web/Application.php(299): yii\base\Module->runAction('queue/run', Array)
#10 /.../.../.../.../.../vendor/craftcms/cms/src/web/Application.php(566): craft\web\Application->runAction('queue/run', Array)
#11 /.../.../.../.../.../vendor/craftcms/cms/src/web/Application.php(278): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#12 /.../.../.../.../.../vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#13 /.../.../.../.../.../public/index.php(21): yii\base\Application->run()
#14 {main}

It seems to be related to a url no being populated on the API call. Not sure if this is a setup issue, or something more serious. Any help would be gratefully received.

Popup Form

I've got my store connected to MailChimp via this plugin, but one option in MailChimp for connected stores is a 'Popup Form'.

It seems that when a store is connected, that you can't actually get the popup form JS as it's meant to inject this for you, via the code it gives you when you connect the site.

But because this plugin connects the site for me, I never get this embed code.

Do you have any idea if this plugin is stopping me getting a popup form?

Setup issues when trying to save after selecting list.

When setting up the plugin we have the api key added. When we go to select a list we continue to receive this error.

{"type":"https://mailchimp.com/developer/marketing/docs/errors/","title":"Bad Request","status":400,"detail":"We were unable to process the request. A store with the domain https://*********.org/ and platform Craft Commerce already exists in the account.","instance":"bdd6896f-fc62-486f-8f0e-c440f6945a26"}.

Where in Mailchimp is this causing an error, integrations? Or is this a Craft Plugin issue? Is the store referencing something in Craft or Mailchimp?

Issues with plugin when using project config

The plugin works pretty bad when using project config.

One of the big problems is that it generates the storeId on install and saves it to the plugin settings which updates the project.yaml file used so all other project.yaml changes (if any) from the same commit will be ignored

Compatibility with Craft Commerce 3.x

Is this plugin compatible with Craft Commerce 3 yet?

I'm trying to upgrade to Commerce 3, but am getting errors about mailchimp-commerce requiriing commerce 2.x, but is not installing with Commerce 3.

Are there plans to update it to Commerce 3 compatibility?

Subscriptions?

Hi,

I'd love to use this plugin on a client site, but the primary product is subscriptions (physical products are a secondary product). Does this plugin have any support for CraftCommerce Subscriptions at all?

Thanks

John

Invalid email on order causes sync process to halt

Have just diagnosed a syncing issue when trying to sync orders to Mailchimp. A number of orders would sync but then an error was thrown. Looking at the logs showed that Mailchimp didn't like the email address.

After a bit of trouble tracking down which order was the problem I found that an order had an incorrect email address (used .con instead of .com).

This address was refused by Mailchimp which caused the plugin to halt the entire sync process.

Would be good if the the plugin could skip past the errors (after logging them with a bit more detail) and continue with the syncing process.

Sync multiple sites

We can sync the products of the primary site (first language) successfully.
Is it also possible to sync products from non-primary sites (other languages)?

Composer install issue

Get the following error when trying to push to live server:

Deprecation Notice: Class ether\mc\base\MailchimpProduct located in ./vendor/ether/mailchimp-commerce/src/base/MailChimpProduct.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///opt/sp/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class HTMLPurifier_Language_en_x_test located in ./vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language/classes/en-x-test.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///opt/sp/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201

Promo Redemption URL setting field should be required.

If the Promo Redemption URL field is not filled in correctly, the promotion synchronization crashes.

The Mailchimp API complains that the url is not valid. This field should be made mandatory or a default url should be provided so the synchronization not crash.

image

Twig variables for data sync?

We have a complex site with a lot of api fetching that we are using from twig variables, like description, thumb and pictures for products.

Is it possible to make a choice in the dropdown that parses/handles twig variables, like the SEOmatic plugin or in some fields in the admin panel?

Here is an example from the use in SEOmatic:
{{ craft.pluginhandle.apifield(object.product.id).description ?? '' }}

Syncing carts + orders + promotions need refactoring

The way it's done right now, it is impossible to synchronize resources when there is a high count.

The problem is, the queue has to process all the elements at once.

To adjust locally, I added one item at a time to the queue. For example, if there are 2000 orders to synchronize, I add 2000 queue jobs for processing all the orders.

That way, no matter how many items you need to process, I'm sure the job won't crash.

Here is an example of one of the controller actions :

$ordersIds = Order::find()->isCompleted(true)->ids();
foreach ($ordersIds as $ordersId) {
   Craft::$app->getQueue()->push(
      new SyncOrders(['orderIds' => [$ordersId]])
   );
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.