WooCommerce class
Create a new Instance of WooCommerce and pass in the necessary parameters into the constructor.
For example
baseUrl: yourbaseUrl, // For example http://mywebsite.com or https://mywebsite.com or http://cs.mywebsite.com
consumerKey: consumerKey,
consumerSecret: consumerSecret);
Constructors
Properties
- apiPath ↔ String
-
Parameter(Optional) apiPath, tells the SDK if there is a different path to your api installation.
Useful if the websites woocommerce api path have been modified.
getter/setter pair
- apiResourceUrl → String
-
no setter
- authToken → String?
-
no setter
- baseUrl ↔ String
-
Parameter, baseUrl is the base url of your site. For example, http://me.com or https://me.com.
getter/setter pair
- consumerKey ↔ String?
-
Parameter consumerKey is the consumer key provided by WooCommerce, e.g.
ck_12abc34n56j
.getter/setter pair - consumerSecret ↔ String?
-
Parameter consumerSecret is the consumer secret provided by WooCommerce, e.g.
cs_1uab8h3s3op
.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- isDebug ↔ bool
-
Parameter(Optional) isDebug, tells the library if it should _printToLog debug logs.
Useful if you are debuging or in development.
getter/setter pair
- isHttps ↔ bool?
-
Returns if the website is https or not based on the baseUrl parameter.
getter/setter pair
- queryUri ↔ Uri?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- urlHeader → String
-
no setter
Methods
-
addToMyCart(
{required String itemId, required String quantity, List< WooProductVariation> ? variations}) → Future<WooCartItem> -
Accepts an int
id
of a product or product variation, int quantity, and an array of chosen variation attribute objects Related endpoint : wc/store/cart -
authenticateViaJWT(
{String? username, String? password}) → Future -
Authenticates the user using WordPress JWT authentication and returns the access
_token
string. -
createCoupon(
{String? code, String? discountType, String? amount, bool? individualUse, bool? excludeSaleItems, String? minimumAmount}) → Future< WooCoupon> - Creates an coupon and returns the WooCoupon object.
-
createCustomer(
WooCustomer customer) → Future< bool> - Creates a new Woocommerce Customer and returns the customer object.
-
createOrder(
WooOrderPayload orderPayload) → Future< WooOrder> - Creates an order and returns the WooOrder object.
-
createProductReview(
{required int productId, int? status, required String reviewer, required String reviewerEmail, required String review, int? rating, bool? verified}) → Future< WooProductReview> - Returns a WooProductReview object.
-
delete(
String endPoint, Map data, {String? aUrl}) → Future -
deleteAllMyCartItems(
) → Future -
deleteCustomer(
{required int customerId, dynamic reassign}) → Future< WooCustomer> - Deletes an existing Customer and returns the WooCustomer object.
-
deleteMyCartItem(
{required String key}) → Future -
deleteOrder(
{required int orderId}) → Future< WooOrder> - Deletes an existing order and returns the WooOrder object.
-
deleteProductReview(
{required int reviewId}) → Future< WooProductReview> - Deletes an existing Product Review and returns the WooProductReview object.
-
deleteShippingZoneMethod(
{required int zoneId, required int methodId}) → Future< WooShippingZoneMethod> - Deletes an existing shipping zone method and returns the WooShippingZoneMethod object.
-
fetchLoggedInUserId(
) → Future< int?> - Fetches already authenticated user, using Jwt
-
get(
String endPoint) → Future - Make a custom get request to a Woocommerce endpoint, using WooCommerce SDK.
-
getAllShippingZoneMethods(
{required int shippingZoneId}) → Future< List< WooShippingZoneMethod> > - Returns a list of all WooShippingZoneMethod associated with a shipping zone.
-
getAShippingMethodFromZone(
{required int zoneId, required int methodId}) → Future< WooShippingZoneMethod> -
Returns a WooShippingZoneMethod object from the specified
zoneId
andmethodId
. -
getAuthTokenFromDb(
) → dynamic -
getCouponById(
int id) → Future< WooCoupon> -
Returns a WooCoupon object with the specified
id
. -
getCoupons(
{int? page, int? perPage, String? search, String? after, String? before, int? offset, String? order, String? orderBy, String? code}) → Future< List< WooCoupon> ?> - Returns a list of all WooCoupon, with filter options.
-
getCustomerById(
{required int? id}) → Future< WooCustomer> -
Returns a WooCustomer, whoose
id
is specified. -
getCustomerDownloads(
{required int customerId}) → Future< List< WooCustomerDownload> > - Returns a list of all WooCustomerDownload, with filter options.
-
getCustomers(
{int? page, int? perPage, String? search, List< int> ? exclude, List<int> ? include, int? offset, String? order, String? orderBy, String? role}) → Future<List< WooCustomer> > - Returns a list of all WooCustomer, with filter options.
-
getMyCart(
) → Future< WooCart> - Returns the current user's WooCart, information
-
getMyCartItemByKey(
String key) → Future< WooCartItem> -
Returns a WooCartItem, with the specified
key
. -
getMyCartItems(
) → Future< List< WooCartItem> > - Returns a list of all WooCartItem.
-
getOrderById(
int id, {String? dp}) → Future< WooOrder> -
Returns a WooOrder object that matches the provided
id
. -
getOrders(
{int? page, int? perPage, String? search, String? after, String? before, List< int> ? exclude, List<int> ? include, int? offset, String? order, String? orderBy, List<int> ? parent, List<int> ? parentExclude, List<String> ? status, int? customer, int? product, int? dp}) → Future<List< WooOrder> > -
Returns a list of all
Order
, with filter options. -
getPaymentGatewayById(
int id) → Future< WooPaymentGateway> -
Returns a WooPaymentGateway object from the specified
id
. -
getPaymentGateways(
) → Future< List< WooPaymentGateway> > - Returns a list of all WooPaymentGateway object.
-
getProductAttributeById(
{required int attributeId}) → Future< WooProductAttribute> -
Returns a WooProductAttribute, with the specified
attributeId
. -
getProductAttributes(
) → Future< List< WooProductAttribute> > - Returns a list of all WooProductAttribute.
-
getProductAttributeTermById(
{required int attributeId, dynamic termId}) → Future< WooProductAttributeTerm> -
Returns a WooProductAttributeTerm, with the specified
attributeId
andtermId
. -
getProductAttributeTerms(
{required int attributeId, int? page, int? perPage, String? search, List< int> ? exclude, List<int> ? include, String? order, String? orderBy, bool? hideEmpty, int? parent, int? product, String? slug}) → Future<List< WooProductAttributeTerm> > - Returns a list of all WooProductAttributeTerm, with filter options.
-
getProductById(
{required int id}) → Future< WooProduct> -
Returns a WooProduct, with the specified
id
. -
getProductCategories(
{int? page, int? perPage, String? search, String? order, String? orderBy, bool? hideEmpty, int? parent, int? product, String? slug}) → Future< List< WooProductCategory> > - Returns a list of all WooProductCategory, with filter options.
-
getProductCategoryById(
{required int categoryId}) → Future< WooProductCategory> -
Returns a WooProductCategory, with the specified
categoryId
. -
getProductReviewById(
{required int reviewId}) → Future< WooProductReview> -
Returns a WooProductReview, with the specified
reviewId
. -
getProductReviews(
{int? page, int? perPage, String? search, String? after, String? before, int? offset, String? order, String? orderBy, List< int> ? reviewer, List<int> ? product, String? status}) → Future<List< WooProductReview> > - Returns a list of all WooProductReview, with filter options.
-
getProducts(
{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, bool? featured, bool? onSale}) → Future<List< WooProduct> > - Returns a list of all WooProduct, with filter options.
-
getProductShippingClassById(
{required int id}) → Future< WooProductShippingClass> -
Returns a WooProductShippingClass, with the specified
id
. -
getProductShippingClasses(
{int? page, int? perPage, String? search, List< int> ? exclude, List<int> ? include, int? offset, String? order, String? orderBy, bool? hideEmpty, int? product, String? slug}) → Future<List< WooProductShippingClass> > - Returns a list of all WooProductShippingClass, with filter options.
-
getProductTagById(
{required int id}) → Future< WooProductTag> -
Returns a WooProductTag, with the specified
id
. -
getProductTags(
{int? page, int? perPage, String? search, int? offset, String? order, String? orderBy, bool? hideEmpty, int? product, String? slug}) → Future< List< WooProductTag> > -
Returns a list of all
ProductTag
, with filter options. -
getProductVariationById(
{required int productId, dynamic variationId}) → Future< WooProductVariation> -
Returns a WooProductVariation, with the specified
productId
andvariationId
. -
getProductVariations(
{required int productId, int? page, int? perPage, String? search, String? after, String? before, List< int> ? exclude, List<int> ? include, int? offset, String? order, String? orderBy, List<int> ? parent, List<int> ? parentExclude, String? slug, String? status, String? sku, String? taxClass, bool? onSale, String? minPrice, String? maxPrice, String? stockStatus}) → Future<List< WooProductVariation> > - Returns a list of all WooProductVariation, with filter options.
-
getProductVariationsByProductId(
{required int productId}) → Future< List< WooProductVariation> > -
Returns a ListWooProductVariation, with the specified
productId
only. -
getQueryString(
Map params, {String prefix = '&', bool inRecursion = false}) → String -
getShippingMethodById(
int id) → Future< WooShippingMethod> -
Returns a WooShippingMethod object with the specified
id
. -
getShippingMethods(
) → Future< List< WooShippingMethod> > - Returns a list of all WooShippingMethod.
-
getShippingZoneById(
int id) → Future< WooShippingZone> -
Returns a WooShippingZone object with the specified
id
. -
getShippingZoneLocations(
{required int shippingZoneId}) → Future< List< WooShippingZoneLocation> > - Returns a list of all WooShippingZoneLocation.
-
getShippingZones(
) → Future< List< WooShippingZone> > - Returns a list of all WooShippingZone.
-
getTaxClasses(
) → Future< List< WooTaxClass> > - Returns a list of all WooTaxClass.
-
getTaxRateById(
int id) → Future< WooTaxRate> -
Returns a WooTaxRate object matching the specified
id
. -
getTaxRates(
{int? page, int? perPage, int? offset, String? order, String? orderBy, String? taxClass}) → Future< List< WooTaxRate> > - Returns a list of all WooTaxRate, with filter options.
-
isCustomerLoggedIn(
) → Future< bool> -
Confirm if a customer is logged in
true
or outfalse
. -
loginCustomer(
{required String username, required String password}) → dynamic - Authenticates the user via JWT and returns a WooCommerce customer object of the current logged in customer.
-
logUserOut(
) → dynamic - Log User out
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
oldelete(
String endPoint, Map data) → Future - Make a custom delete request to Woocommerce, using WooCommerce SDK.
-
oldget(
String endPoint) → Future -
oldUpdateCustomer(
{required WooCustomer wooCustomer}) → Future< WooCustomer> - Updates an existing Customer and returns the WooCustomer object.
-
oldUpdateOrder(
WooOrder order) → Future< WooOrder> - Updates an existing order and returns the WooOrder object.
-
post(
String endPoint, Map data) → Future - Make a custom post request to Woocommerce, using WooCommerce SDK.
-
put(
String endPoint, Map? data) → Future - Make a custom put request to Woocommerce, using WooCommerce SDK.
-
registerNewWpUser(
{required WooUser user}) → Future< bool> - Creates a new Wordpress user and returns whether action was sucessful or not using WP Rest User Wordpress plugin.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateCustomer(
{required int id, Map? data}) → Future< WooCustomer> -
updateMyCartItemByKey(
{required String key, required int id, required int quantity, List< WooProductVariation> ? variations}) → Future<WooCartItem> -
updateOrder(
{Map? orderMap, int? id}) → Future< WooOrder> -
updatePaymentGateway(
WooPaymentGateway gateway) → Future< WooPaymentGateway> - Updates an existing order and returns the WooPaymentGateway object.
-
updateProductReview(
{required WooProductReview productReview}) → Future< WooProductReview> - Updates an existing Product Review and returns the WooProductReview object.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited