modules/acm_sku/src/Commands/AcmSkuDrushCommands.php
public function flushSyncedData() {
    if (!$this->io()->confirm(dt("Are you sure you want to clean commerce data?"))) {
      throw new UserAbortException();
    }
    $this->output->writeln(dt('Cleaning synced commerce data, please wait...'));

    // Set batch operation.
    $batch = [
      'title' => t('Clean synced data'),
      'init_message' => t('Cleaning synced commerce data starting...'),
      'operations' => [
        ['\Drupal\acm_sku\Commands\AcmSkuDrushCommands::skuCleanProcess', []],
      ],
      'progress_message' => t('Processed @current out of @total.'),
      'error_message' => t('Synced data could not be cleaned because an error occurred.'),
      'finished' => '_acm_sku_clean_finished',
    ];

    batch_set($batch);
    drush_backend_batch_process();
    $this->output->writeln(dt('Synced commerce data cleaned.'));
  }
public function flushSyncedData() {
    if (!$this->io()->confirm(dt("Are you sure you want to clean commerce data?"))) {
      throw new UserAbortException();
    }
    $this->output->writeln(dt('Cleaning synced commerce data, please wait...'));

    // Set batch operation.
    $batch = [
      'title' => t('Clean synced data'),
      'init_message' => t('Cleaning synced commerce data starting...'),
      'operations' => [
        ['\Drupal\acm_sku\Commands\AcmSkuDrushCommands::skuCleanProcess', []],
      ],
      'progress_message' => t('Processed @current out of @total.'),
      'error_message' => t('Synced data could not be cleaned because an error occurred.'),
      'finished' => '_acm_sku_clean_finished',
    ];

    batch_set($batch);
    drush_backend_batch_process();
    $this->output->writeln(dt('Synced commerce data cleaned.'));
  }
public function flushSyncedData ( ) { if ( ! $ this -> io ( ) -> confirm ( dt ( "Are you sure you want to clean commerce data?" ) ) ) { throw new UserAbortException ( ) ; } $ this -> output -> writeln ( dt ( 'Cleaning synced commerce data, please wait...' ) ) ; // Set batch operation. $ batch = [ 'title' => t ( 'Clean synced data' ) , 'init_message' => t ( 'Cleaning synced commerce data starting...' ) , 'operations' => [ [ '\Drupal\acm_sku\Commands\AcmSkuDrushCommands::skuCleanProcess' , [ ] ] , ] , 'progress_message' => t ( 'Processed @current out of @total.' ) , 'error_message' => t ( 'Synced data could not be cleaned because an error occurred.' ) , 'finished' => '_acm_sku_clean_finished' , ] ; batch_set ( $ batch ) ; drush_backend_batch_process ( ) ; $ this -> output -> writeln ( dt ( 'Synced commerce data cleaned.' ) ) ; }
Flush all commerce data from the site.

Handles Products, SKUs, Product Categories and Product Options and allows
more data to be added for cleanup via alter hook.

@command acm_sku:flush-synced-data

@validate-module-enabled acm_sku

@aliases accd,clean-synced-data

@usage drush accd
Flush all commerce data from the site (Products, SKUs, Product Categories
and Product Options).

@throws \Drush\Exceptions\UserAbortException
Flush all commerce data from the site .