wc_batch_processing_max_attempts
Controls the failure threshold for batch processors. That is, the number of times we'll attempt to process a batch that has resulted in a failure. Once above this threshold, the processor won't be re-scheduled and will be removed from the queue.
Usage
add_filter( 'wc_batch_processing_max_attempts', 'wp_kama_wc_batch_processing_max_attempts_filter', 10, 3 );
/**
* Function for `wc_batch_processing_max_attempts` filter-hook.
*
* @param int $failure_threshold Maximum number of times for the processor to try processing a given batch.
* @param BatchProcessorInterface $batch_processor The processor instance.
* @param array $process_details Array with batch processor state.
*
* @return int
*/
function wp_kama_wc_batch_processing_max_attempts_filter( $failure_threshold, $batch_processor, $process_details ){
// filter...
return $failure_threshold;
}
- $failure_threshold(int)
- Maximum number of times for the processor to try processing a given batch.
- $batch_processor(BatchProcessorInterface)
- The processor instance.
- $process_details(array)
- Array with batch processor state.
Changelog
| Since 9.1.0 | Introduced. |
Where the hook is called
wc_batch_processing_max_attempts
woocommerce/src/Internal/BatchProcessing/BatchProcessingController.php 501-506
apply_filters( 'wc_batch_processing_max_attempts', self::FAILING_PROCESS_MAX_ATTEMPTS_DEFAULT, $batch_processor, $process_details )