Skip to content

Instantly share code, notes, and snippets.

@thenbrent
Last active October 22, 2015 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thenbrent/709cc49ae6025f5c9595 to your computer and use it in GitHub Desktop.
Save thenbrent/709cc49ae6025f5c9595 to your computer and use it in GitHub Desktop.
Reduce batch size for WooCommerce Subscriptions upgrade process.
<?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