autoship_reset_all_products_activate (function)
(src/products.php) Used to update the Active flag in QPilot for all products except for any Product Id's supplied. It takes $enabled ('yes' or 'no') and $excluded_ids as its parameters.
Function
/**
* Updates the Active flag for all products in QPilot except for those supplied.
*
* @param string $enable. 'yes' to activate all else 'no'
* @param array $exclude_ids An array of product ids to exclude.
*/
function autoship_reset_all_products_activate ( $enable, $exclude_ids = array() ){
// Create the QPilot client
// Grab the client and only continue if connection exists.
if ( empty( $client = autoship_get_default_client() ) || empty( $client->get_token_auth() ) )
return false;
$activate = 'yes' === $enable ? 'true' : 'false';
try {
// update product availability
$result = $client->batch_activate_deactivate_products( $activate , $exclude_ids );
}
catch (Exception $e) {
autoship_log_entry( __( 'Autoship Products', 'autoship' ), $e->getMessage() );
}
do_action( 'autoship_after_update_product_activate', $enable, $exclude_ids );
return true;
}