Last active
September 24, 2020 06:32
-
-
Save thejamescollins/6219974992ecacad49dad10de9d1f274 to your computer and use it in GitHub Desktop.
WooCommerce.com Subscriptions Check Timeout Increase
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 | |
/** | |
* 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