autoship_deactivate_sync_bulk_handler (function)
(src/product-page.php) Handles the Autoship All Products Deactivate for Sync Action. It takes a $redirect_url, the current $action being performed, and the Product Ids ($post_ids) as its parameters, returning the $redirect_url.
Function
/** * Handles the Autoship All Products Deactivate Sync Bulk Action * @param string $redirect_url The url to redirect user to after done. * @param string $action The current action being performed. * @param array $post_ids The selected post ids being performed against. * * @return string The redirect url. */ function autoship_deactivate_sync_bulk_action_handler( $redirect_url, $action, $post_ids ){ // Go through the ids and deactivate the products. $updated = $not_updated = array(); foreach ( $post_ids as $post_id ) { if ( !autoship_is_valid_sync_post_type( $post_id ) ) { $not_updated[] = $post_id; continue; } // Enable the option $result = autoship_set_product_sync_active_enabled ( $post_id ,'no' ); // Update the Simple, Variable or Variation in QPilot. $result = autoship_push_product ( $post_id ); $updated[] = $post_id; } $notice = sprintf( __('<h3>Autoship Cloud Bulk Action</h3><p><strong>%d Products Deactivated</strong> from synchronizing with QPilot.</p>', 'autoship'), count( $updated ) ); if ( !empty( $not_updated ) ) $notice .= sprintf( __('<hr/><p>%d Products were not updated since they were not valid QPilot product types.</p>', 'autoship'), count( $not_updated ) ); autoship_add_message( $notice, 'autoship-general-notice' , 'autoship_all_products_bulk_action_messages' ); do_action( 'autoship_after_all_products_autoship_deactivate_sync_bulk_action', $post_ids, $action, $redirect_url ); return $redirect_url; }