WooCommerce Rest API for PHP

v0.7.0 2020-05-11 11:59 UTC

This package is auto-updated.

Last update: 2024-02-11 20:33:18 UTC


License Build Status StyleCI Quality Score Downloads Latest Version on Packagist


WooCommerce Rest API for Laravel. You can Get, Create, Update and Delete your woocommerce product using this package easily.




Eloquent Style for Product, Customer and Order

// Where passing multiple parameters
$products = Product::where('title','hello')->get();
// You can call field with where clause
$products = Product::whereTitle('hello')->get();
// Fields name are more than one words or seperate by underscore (_). For example field name is `min_price`
$products = Product::whereMinPrice(5)->get();

// Where passing an array
$orders = Order::where(['status' => 'processing']);
$orders = Order::where(['status' => 'processing', 'orderby' => 'id', 'order' => 'asc'])->get();

// Set Options
$orders = Order::options(['status' => 'processing', 'orderby' => 'id', 'order' => 'asc'])->get();

// You can set options by passing an array when call `all` method
$orders = Order::all(['status' => 'processing', 'orderby' => 'id', 'order' => 'asc']);

#Product Options:

#Customer Options:

#Order Options:

You can also use WooCommerce Facade

use Codexshaper\WooCommerce\Facades\WooCommerce;

public function products()
  return WooCommerce::all('products');

public function product( Request $request )
  $product = WooCommerce::find('products/'.$request->id);

public function orders()
  return WooCommerce::all('orders');

public function order( Request $request )
  $order = WooCommerce::all('orders/'.$request->id);

public function customers()
  return WooCommerce::all('customers');

public function customer( Request $request )
  $customer = WooCommerce::all('customers/'.$request->id);

Use Facade Alias

use WooCommerce // Same as use Codexshaper\WooCommerce\Facades\WooCommerce;
use Customer // Same as use Codexshaper\WooCommerce\Models\Customer;
use Order // Same as use Codexshaper\WooCommerce\Models\Order;
use Product // Same as Codexshaper\WooCommerce\Models\Product;