Skip to content

A dart package to interact with the WooCommerce REST API.

License

Notifications You must be signed in to change notification settings

alalawi310/woocommerce_dart

 
 

Repository files navigation

WooCommerce SDK for Dart

A dart package to interact with the WooCommerce API. It uses OAuth1.0a behind the scenes to generate the signature and URL string. It then makes calls and return the data back to the calling function.

Example code and preview

Examples

GET request (Fetch products)

Future getProducts() async {
  // Initialize the API
  WooCommerceAPI wooCommerceAPI = WooCommerceAPI(
      url: "https://www.yourwebsite.com",
      consumerKey: "ck_your_consumer_key",
      consumerSecret: "cs_your_consumer_secret");

  // Get data using the "products" endpoint
  var products = await wooCommerceAPI.getAsync("products");
  return products;
}

You can find a full example here

POST request (Create a customer)

Future createCustomer() async {
  try {
    var response = await wooCommerceAPI.postAsync(
      "customers",
      {
        "email": '[email protected]',
        "password": "123",
        "billing": {
          "first_name": "Samarth",
        }
      },
    );
    print(response); // JSON Object with response
  } catch (e) {
    print(e);
  }
}

Report any issues if you face any or drop me an email at [email protected]

About

A dart package to interact with the WooCommerce REST API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 89.4%
  • Objective-C 5.3%
  • Java 5.3%