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

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.getProducts().then( (products) {
        print(products.toJson());
    });

});

Response

List<Product> instance

Represents the following object - WooCommerce list all products


Retrive a product

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

getProductsForId({id:"product id"})

Parameters

    int id

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.getProductsForId({id: 2}).then((product){
        print(product.toJson());
    });

});

Response

Product instance

Represents the following object - WooCommerce retrieve a product

delete-a-product update-a-product create-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

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
    wcStore.batchProduct({data: {}}).then((productBatch){
        print(productBatch.toJson());
    });
});

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

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
    wcStore.deleteProduct(int id).then((product){
        print(product.toJson());
    });
});

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

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
    wcStore.updateProduct(int id, data: {}).then((product){
        print(product.toJson());
    });
});

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

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
    wcStore.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,
    }).then((product){
        print(product.toJson());
    });
});

Response

Product instance

Represents the following object - WooCommerce product