Products


Overview

The products API allows you to view individual or a batch of products.


List all products

Returns products back from WooCommerce, include parameters to query data.

getProducts()

Parameters

    int page,
    int perPage,
    String search,
    String after,
    String before,
    String order,
    String orderBy,
    String slug,
    String status,
    String type,
    String sku,
    String category,
    String tag,
    String shippingClass,
    String attribute,
    String attributeTerm,
    String taxClass,
    String minPrice,
    String maxPrice,
    String stockStatus,
    List<int> exclude,
    List<int> parentExclude,
    List<int> include,
    List<int> parent,
    int offset = 0,
    bool featured,
    bool onSale

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
List<Product> products = await WooSignal.instance.getProducts();

Response

List<Product> instance

Represents the following object - WooCommerce list all products


Retrieve a product

Returns a product back from WooCommerce, include parameters to query data.

retrieveProduct({id:"product id"})

Parameters

    int id

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
Product product = await WooSignal.instance.retrieveProduct(id: "product id");

Response

Product instance

Represents the following object - WooCommerce retrieve a product


Batch Products

This API helps you to batch create, update and delete multiple orders.

batchProduct({ data })

Parameters

Map<String, dynamic> data

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
ProductBatch productBatch = await WooSignal.instance.batchProduct(data: "batch update data");

Response

ProductBatch instance

Represents the following object - WooCommerce batch product


Delete a product

This API helps you delete a product.

deleteProduct(int id, {bool force = true})

Parameters

int id, 
{bool force = true}

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
Product product = await WooSignal.instance.deleteProduct(id: "product id");

Response

Product instance

Represents the following object - WooCommerce product


Update a product

This API lets you make changes to a product.

updateProduct(int id, { data })

Parameters

int id, 
{Map<String, dynamic> data}

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
Product product = await WooSignal.instance.updateProduct(id: "product id");

Response

Product instance

Represents the following object - WooCommerce product


Create a product

This API helps you to create a new product.

createProduct({})

Parameters

required String name,
required String type, // simple, grouped, external and variable.
required String regularPrice,
required String description,
required String shortDescription,
required Map<String, dynamic> categories,
required Map<String, dynamic> images,

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
Product product = await WooSignal.instance.createProduct({
    required String name,
    required String type,
    required String regularPrice,
    required String description,
    required String shortDescription,
    required Map<String, dynamic> categories,
    required Map<String, dynamic> images,
    });

Response

Product instance

Represents the following object - WooCommerce product