Last active
October 22, 2015 21:25
-
-
Save thenbrent/709cc49ae6025f5c9595 to your computer and use it in GitHub Desktop.
Reduce batch size for WooCommerce Subscriptions upgrade process.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WooCommerce Subscriptions Reduce Upgrade Batch Size | |
* Plugin URI: | |
* Description: Drastically reduce the size of each batch of data WooCommerce Subscriptions upgrades per request. Handy to avoiding low script timeout settings on Nginx. | |
* Author: Prospress Inc. | |
* Version: 1.0 | |
* Author URI: http://prospress.com | |
*/ | |
function eg_reduce_wcs_upgrade_batch_size( $batch_size ) { | |
return ceil( $batch_size / 3 ); | |
} | |
add_filter( 'woocommerce_subscriptions_hooks_to_upgrade', 'eg_reduce_wcs_upgrade_batch_size', 100 ); | |
add_filter( 'woocommerce_subscriptions_to_upgrade', 'eg_reduce_wcs_upgrade_batch_size', 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment