A comprehensive Flutter package for seamless WooCommerce integration. Easily manage authentication, notifications, cart, and product data with updated dependencies and full documentation.
This package leverages the following dependencies:
- dio (^5.4.1) for HTTP requests
- faker (^2.1.0) for generating fake data during development
- flutter_secure_storage (^9.0.0) for secure data storage
- pretty_dio_logger (^1.3.1) for logging HTTP requests in a readable format
To install the package, run:
flutter pub add woocommerce_flutter_api
Create the main WooCommerce object to access all the features of the package:
final woocommerce = WooCommerce(
baseUrl: '<woocommerce-url>',
username: '<username>',
password: '<password>',
useFaker: true,
isDebug: true, // true by default
apiPath: '<some-custom-path>',
);
The useFaker
property is designed for development and testing purposes. When set to true
, all API requests will return fake data generated by the faker package. This is especially useful if your WooCommerce backend is still under development—allowing you to build and test your application without relying on live data. Once your backend is ready, simply set useFaker
to false
to receive real data.
Example of initializing with fake data enabled:
final woocommerce = WooCommerce(
baseUrl: '<woocommerce-url>',
username: '<username>',
password: '<password>',
useFaker: true,
isDebug: true, // true by default
apiPath: '<some-custom-path>',
);
In this mode, every API call (e.g., authentication, notifications, cart, products) will return simulated responses, allowing you to continue development seamlessly until your WooCommerce backend is published.
Login and securely store the user ID:
await woocommerce.login('<email>', '<password>');
Fetch all notifications for the currently logged in user:
final notifications = await woocommerce.getNotifications();
Retrieve the cart for the current user:
final cart = await woocommerce.getCart();
Fetch a list of products:
final response = await woocommerce.getProducts();
This package is actively being developed, and the following features have been implemented so far:
- Authentication (Login & Secure Storage)
- Fetching Notifications
- Managing Cart (Retrieve user cart)
- Fetching Products
- Order Management (Retrieve, Create, Update, and Delete orders)
- Product Tags API (Get, Create, Update, Delete product tags)
- Coupon Management (Retrieve, Create, Update, and Delete coupons)
- Customer Management (Retrieve, Create, Update, and Delete customers)
- Order Additional Features (actions, notes, refunds)
- Product Additional Features (shipping classes, reviews)
- Reports API
- Tax rates API
- Tax classes API
- Refunds API
- Webhook API
- Settings API
- Setting Options API
- Payment Gateways API
- Shipping API (zones, locations, methods)
- System status API
- System status tools API
- Data API
- Better documentation
Contributions are welcome! If you have suggestions, bug fixes, or improvements, please open an issue or submit a pull request. Your contributions will help make this package even better.