简体   繁体   中英

Woocommerce codeigniter Rest API

I am writing a API in Woocommerce.I want to get featured products , am using codeigniter framework, check the below code

public function get_products()
{
    $params = [
        'filter' => [
            'limit' => 10,
            'q' => 'Hoodie',
        ],
        'page' => 1,
        'featured' => 1,
    ];
    $results = $this->woo_client->products->get('', $params);
    echo "<pre>";
    print_r($results);
}

In this above code filter function is not working.Can u help me?

The WP API Repo have a plugin 'Rest Filter' for this job, small and short.

You can use this plugin for use filter option.

Just install the plugin and the filter param should work like before.

Or another option is using library.

For this, I recommended library which is in this library WooCommerce Library for CodeIgniter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM