Skip to content

Instantly share code, notes, and snippets.

@om4james
Last active September 24, 2020 06:32
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 om4james/6219974992ecacad49dad10de9d1f274 to your computer and use it in GitHub Desktop.
Save om4james/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