I’m trying to get all WooCommerce products list from API to my Vue-script. For common WP API I used code:
fetchPosts: function(){
var url = 'https://some-example-website.org/wp-json/wp/v2/post';
fetch(url).then((response)=>{
return response.json()
}).then((data)=>{
this.posts = data;
});
},
and got posts objects array from JSON, and did all I need with it.
I’m trying to use URL https://some-example-website.org//wp-json/wc/v2/products. But it returns 401 error
Is there some simple way just to get products (all data), without any authorization, any secret keys? Or I should be only authenticated user? Can’t find info neither in WC API docs, no another web-resources.
2
Answers
At least (and like some guys advised) I created own "end-point", something like very simple, almost ridiculous API page:
Maybe I was wrong. But it works.
Similar question has been asked, which indicates that none of the WooCommerce REST endpoints are public, but there may be options to do so.