PHP code example of ether / mailchimp-commerce

1. Go to this page and download the library: Download ether/mailchimp-commerce library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ether / mailchimp-commerce example snippets




return [
	'staging' => [
		'disableSyncing' => true,
	],
];

Event::on(
    \ether\mc\services\ProductsService::class,
    \ether\mc\services\ProductsService::EVENT_AFTER_BUILD_SYNC_DATA,
    function (\ether\mc\events\BuildSyncDataEvent $event) {
        $event->element; // The element being synced
        $event->syncData; // The resulting data to sync

        // For example, to modify the product description
        $event->syncData->description = $event->element->alternateDescriptionField;
    }
);