2

I am trying to get all product attributes by WooCommerce REST API using the following code:

$current_attributes = $woocommerce->get('products/attributes');

However I always receive up to 10 attributes maximum.

I tried a several variants like:

$current_attributes = $woocommerce->get('products/attributes', ['filter[limit]' => -1]);
$current_attributes = $woocommerce->get('products/attributes', ['filter[per_page]' => 9999]);
etc.

None of these works.

How can I get all product attributes (and later similarly all attributes terms) without the obvious limit for 10?

PS: I really need to list ALL attributes and ALL terms and not only those attached to a specific product.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
tinchev
  • 21
  • 2

1 Answers1

0

I had used wc/v3/products/attributes

Invoke a simple GET Request: `

`https://hostname.com/wp-json/wc/v3/products/attributes?consumer_key=YOUR_KEY&consumer_secret=YOUR_KEY``

For more info, you can find API spec from https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#list-all-product-attributes

Rissmon Suresh
  • 13,173
  • 5
  • 29
  • 38