ethercreative / mailchimp-commerce

Mailchimp integration with Craft Commerce
Other
5 stars 11 forks source link

Support for Donations #45

Open ragnarfrosti opened 3 years ago

ragnarfrosti commented 3 years ago

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();