public function MailchimpEcommerceCommerceSync::_submitForm in Mailchimp E-Commerce 8
Processes data sync to Mailchimp.
Syncing data to Mailchimp is specific to the shopping cart integration. You should implement this function in your integration to process the data sync.
Overrides MailchimpEcommerceSync::_submitForm
File
- modules/
mailchimp_ecommerce_commerce/ src/ Form/ MailchimpEcommerceCommerceSync.php, line 21
Class
Namespace
Drupal\mailchimp_ecommerce_commerce\FormCode
public function _submitForm($form, $form_state) {
if (!empty($form_state
->getValue('sync_products'))) {
$batch = [
'title' => t('Adding products to Mailchimp'),
'operations' => [],
];
$query = \Drupal::entityQuery('commerce_product');
$result = $query
->execute();
if (!empty($result)) {
$product_ids = array_keys($result);
$batch['operations'][] = [
'\\Drupal\\mailchimp_ecommerce_commerce\\BatchSyncProducts::syncProducts',
[
$product_ids,
],
];
}
batch_set($batch);
}
}