kloon / WooCommerce-REST-API-Client-Library

A PHP wrapper for the WooCommerce REST API
GNU General Public License v3.0
356 stars 175 forks source link

Attrubutes and terms endpoints #165

Open jcampos73 opened 8 years ago

jcampos73 commented 8 years ago

Hello,

Is library updated to use attributes and terms end points?

Thx

Best regards

dyluck07 commented 8 years ago

I know this is old, but for others: you need to extend or update the WC_API_Client_Resource_Products class located in /resources/class-wc-api-client-resource-products.php then put in

public function get_attributes( $id = null, $args = array() ) {

        $this->set_request_args( array(
            'method' => 'GET',
            'path'   => array( 'attributes', $id ),
            'params' => $args,
        ) );

        return $this->do_request();
    }

usage is: print_r($client->products->get_attributes());

It only works with GET as this code uses only woocommerce V2 api... I'm discovering that this hasn't been updated for some time. I'm hoping they revisit this tool (as it is really helpful) and get it to work with woocommerce new API that works directly with wordpress API and include all controllers. The endpoint going from /wc-api/v2/ to use /wc-auth/v1/authorize for authentication and /wp-json/wc/v1 for requests.

jcampos73 commented 8 years ago

Hello,

Maybe the most updated php client API is now:

https://github.com/woothemes/wc-api-php

Thx for the answer