WooCommerce REST API Product Image Relative URL Issue

I am consuming the WooCommerce REST API (in a mobile app) to retrieve a list of products. My problem is that URLs for the product images are relative.

For example, in the response from the service /wp-json/wc/v1/products, I get images[0].src:
“/wp-content/uploads/2013/06/cd_6_angle.jpg” when I was expecting

This appears to happen for all services that return product image URLs.

I am using WordPress version 4.7.4 with WooCommerce version 3.0.4. I don’t think this problem occurred with an earlier version I tested a few weeks ago (I don’t know which version exactly, but it was up-to-date at the time).

The WooCommerce REST API gives an example (http://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products) of output showing an absolute URL for the product image.

Is this an undocumented change to the API, or is it a configuration setting somewhere? Or do I perhaps have to customize the code of WooCommerce to get an absolute URL?

Read more here: WooCommerce REST API Product Image Relative URL Issue

Leave a Reply

Your email address will not be published. Required fields are marked *