woocommerce / wc-api-php

WooCommerce REST API PHP Library
https://packagist.org/packages/automattic/woocommerce
MIT License
528 stars 160 forks source link

Get all products that have an attribute x #326

Open bertux77 opened 2 years ago

bertux77 commented 2 years ago

Get all products that have an attribute x

Hi, I would like to find a way to get all the products that match an attribute marca= 226ers. I have tried a thousand ways but none of them work. Here is an example:

$data = [
            'attributes' => [
                [
                    'id' => 3,// id of attribute Marca
                    'options' => '226Ers'
                ]
            ]
        ];
        $this->productos = $woocommerce->get('products', $data);

Any help? Thanks

jasie commented 2 years ago

I think you will have more luck getting an answer if you post this type of question on stackoverflow.com.

Fidelity88 commented 2 years ago

Did you ever figure this out? @bertux77