Skip to content

Instantly share code, notes, and snippets.

@thejamescollins
Last active September 24, 2020 06:32
Show Gist options
  • Save thejamescollins/6219974992ecacad49dad10de9d1f274 to your computer and use it in GitHub Desktop.
Save thejamescollins/6219974992ecacad49dad10de9d1f274 to your computer and use it in GitHub Desktop.
WooCommerce.com Subscriptions Check Timeout Increase
<?php
/**
* When WooCommerce core checks for subscriptions on the Dashboard -> WooCommerce -> Extensions -> WooCommerce.com Subscriptions screen,
* sometimes a "Could not find any subscriptions on your WooCommerce.com account" error occurs.
*
* This code snippet increases the 5 second timeout for the request to a much higher 30 seconds, which should help prevent the error.
*/
add_filter(
'woocommerce_helper_api_request_args',
function( $args, $endpoint ) {
if ( 'subscriptions' === $endpoint ) {
$args['timeout'] = 30;
}
return $args;
},
10,
2
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment