I have a PHP(Laravel) application that pushes data to WooCommerce through the WooCommerce REST API, everything works except for images. I was able to pin this down to
I had found a way around this, but I cannot recall where I found it. I seem to remember a hook in functions.php that turned off this feature. It wasn't recommended, but it is the only recourse.
Can anyone help me out? Or does anyone have another solution? I'm only pushing URLs from an application I made from the same server.
Code Example from External Application
$this->woocommerce->post('products', ['product' => $book_data_array])
$this->woocommerce is an instance of the WooCommerce API.
$book_data_array is an array of data. For an example of the data arra, see: 'http://woocommerce.github.io/woocommerce-rest-api-docs/wp-api-v1.html#create-a-product'
The only thing that doesn't work is images coming from the same server, which is a WordPress issue and has been confirmed as much by a WooCommerce dev. WordPress doesn't allow downloads from the same origin without an override.
wp_safe_remote_getbeing called? By API I assume you mean the REST API?
wp_safe_remote_getis being called wherever WordPress calls it, I'm not calling it anywhere specifically. My assumption is the WooCommerce REST API is using the native WordPress REST API. I do mean REST API. You assumed correctly.
wp_safe_remote_getto filter out URLs coming from the same server.