This is particularly useful to override the default timeout. I find I need to when updating a Product with a large number of gallery images (especially when using S3 for image storage), as the single Product update involves uploading all the images in one batch. This can easily take more than the default 10 seconds, so without this option, will timeout even when working successfully.
Here's a snippet of me using this option:
@woocommerce = WooCommerce::API.new(
"http://" + wooconfig['url'],
wooconfig["consumer_key"], # Your consumer key
wooconfig["consumer_secret"], # Your consumer secret
{
wp_api: true, # Enable the WP REST API integration
version: "wc/v1",
debug_mode: false,
http_args: { timeout: 60 }
}
)
This is particularly useful to override the default timeout. I find I need to when updating a Product with a large number of gallery images (especially when using S3 for image storage), as the single Product update involves uploading all the images in one batch. This can easily take more than the default 10 seconds, so without this option, will timeout even when working successfully.
Here's a snippet of me using this option: