2017 © Pedro Peláez
 

library woocommerce-api

WooCommerce API Client using namespaces

image

redooc/woocommerce-api

WooCommerce API Client using namespaces

  • Wednesday, April 4, 2018
  • by ivan.buttinoni
  • Repository
  • 5 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 165 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

WooCommerce REST API Client Library

About

A PHP wrapper for the WooCommerce REST API. Easily interact with the WooCommerce REST API using this wrapper class. Feedback and bug reports are appreciated., (*1)

Requirements

PHP 5.2.x cURL WooCommerce 2.1 at least on the store, (*2)

Getting started

Generate API credentials ( Consumer Key & Consumer Secret ) on your profile page for the store you want to interact with., (*3)

A good place to start is to look at the example script included., (*4)

Initialize the class


Get the data using methods

<?php
    // Get all orders
    $orders = $wc_api->get_orders();
    print_r( $orders );
?>

All methods return the data json_decode() by default so you can access the data., (*5)

Available methods

Index method

  • get_index()

Order methods

  • get_orders()
  • get_orders( $params = array( 'status' => 'completed' ) )
  • get_order( $order_id )
  • get_orders_count()
  • get_order_notes( $order_id )
  • update_order( $order_id, $data = array( 'status' => 'processing' ) )
  • update_order( $order_id, $data = array( 'status' => 'processing', 'note' => 'This is a note') )

Coupon methods

  • get_coupons()
  • get_coupon( $coupon_id )
  • get_coupon_by_code( $coupon_code )
  • get_coupons_count()

Customer methods

  • get_customers()
  • get_customers( $params = array( 'filter[created_at_min]' => '2013-12-01' ) )
  • get_customer( $customer_id )
  • get_customers_count()
  • get_customer_orders( $customer_id )

Product methods

  • get_products()
  • get_products( $params = array( 'filter[created_at_min]' => '2013-12-01' ) )
  • get_product( $product_id )
  • get_products_count()
  • get_product_reviews( $product_id )

Report methods

  • get_reports()
  • get_sales_report( $params = array( 'filter[start_date]' => '2013-12-01', 'filter[end_date]' => '2013-12-09' ) )
  • get_top_sellers_report( $params = array( 'filter[limit]' = '10' ) )

Custom endpoints

If you extended the WooCommerce API with your own endpoints you can use the following function to get access to that data - make_custom_endpoint_call( $endpoint, $params = array(), $method = 'GET' ), (*6)

Changelog

version 0.3.1 - 2014-05-02, (*7)

  • Fix parameter normalization issue with WC 2.1.7+

version 0.3 - 2014-02-20, (*8)

  • Add HTTP error messages on failed cURL calls

version 0.2 - 2014-01-22, (*9)

  • Add support for filters/params to endpoint functions
  • Add new top sellers report endpoint function
  • Add function to call custom endpoints

version 0.1 - 2013-12-10, (*10)

  • Initial release

Credit

Copyright (c) 2013-2014 - Gerhard Potgieter Released under the GPL3 license, (*11)

The Versions

04/04 2018

v2.x-dev

2.9999999.9999999.9999999-dev

WooCommerce API Client using namespaces

  Sources   Download

GPL-3.0-only

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-json *

 

05/04 2015

2.x-dev

2.9999999.9999999.9999999-dev

WooCommerce API Client using namespaces

  Sources   Download

The Requires

  • php >=5.4.0