WooCommerceNET 0.8.5
dotnet add package WooCommerceNET --version 0.8.5
NuGet\Install-Package WooCommerceNET -Version 0.8.5
<PackageReference Include="WooCommerceNET" Version="0.8.5" />
paket add WooCommerceNET --version 0.8.5
#r "nuget: WooCommerceNET, 0.8.5"
// Install WooCommerceNET as a Cake Addin
#addin nuget:?package=WooCommerceNET&version=0.8.5
// Install WooCommerceNET as a Cake Tool
#tool nuget:?package=WooCommerceNET&version=0.8.5
WooCommerce.NET
A Brief Intro
WooCommerce.NET is a .NET library for calling WooCommerce/WordPress REST API with OAuth/JWT in .NET applications.
If this project has been helpful for you and you want to support it, please consider Buying me a coffee:coffee:
Usage (WooCommerce REST API)
- How to use JSON.NET in WooCommerce.NET
- Specifiy user agent when making requests to WooCommerce
- How to use webRequestFilter and webResponseFilter in WooCommerce.NET
- Use X HTTP MethodOverride header for DELETE PUT
- Handle different types of Meta Value in WC Restful API V2
<details open> <summary>Click to expand/collapse details...</summary>
using WooCommerceNET.WooCommerce.v3;
using WooCommerceNET.WooCommerce.v3.Extension;
RestAPI rest = new RestAPI("http://www.yourstore.co.nz/wp-json/wc/v3/", "<WooCommerce Key>", "<WooCommerce Secret");
WCObject wc = new WCObject(rest);
//Get all products
var products = await wc.Product.GetAll();
//Add new product
Product p = new Product()
{
name = "test product 8",
title = "test product 8",
description = "test product 8",
price = 8.0M
};
await wc.Product.Add(p);
//Update products with new values
await wc.Product.Update(128, new Product { name = "test 9" });
//Update products with Null values
await wc.Product.UpdateWithNull(128, new { name = "test 9", weight = "", date_on_sale_from = "", date_on_sale_to = "" });
//Delete product
await wc.Product.Delete(128);
//Use parameters
var p = await wc.Product.GetAll(new Dictionary<string, string>() {
{ "include", "10, 11, 12, 13, 14, 15" },
{ "per_page", "15" } });
//Batch add/update/delete
CustomerBatch cb = new CustomerBatch();
List<Customer> create = new List<Customer>();
create.Add(new Customer()
{
first_name = "first",
last_name = "last",
email = "first@lastsss.com",
username = "firstnlast",
password = "12345"
});
List<Customer> update = new List<Customer>();
update.Add(new Customer()
{
id = 4,
last_name = "xu2"
});
List<int> delete = new List<int>() { 8 };
cb.create = create;
cb.update = update;
cb.delete = delete;
var c = await wc.Customer.UpdateRange(cb);
</details>
Usage (WordPress REST API - JWT/OAuth Authentication)
- How to setup Restful API via JWT Authentication in WordPress
- How to setup Restful API via OAuth 1.0a in WordPress
<details> <summary>Click to expand/collapse details...</summary>
//using JWT
RestAPI rest = new RestAPI("http://www.yourstore.co.nz/wp-json/jwt-auth/v1/token", "<UserName>", "<Password>");
//using OAuth
RestAPI rest = new RestAPI("http://www.yourstore.co.nz/wp-json/wp/v2/", "<Client_Key>", "<Client_Secret>");
rest.oauth_token = "<OAuth_Token>";
rest.oauth_token_secret = "<OAuth_Token_Secret>";
WPObject wp = new WPObject(rest);
//Get all posts
var posts = await wp.Post.GetAll();
//Add a post
var p = new Posts()
{
title = "abc",
content = "<h1>abc</h1>"
};
await wp.Post.Add(p);
//Update post with new values
await wp.Post.Update(123, new { title = "new post" });
//Delete a post
await wp.Post.Delete(123);
//Upload an image
await wp.Media.Add("imagename.jpg", @"C:\path\to\image\file.jpg");
//Create a new user
await wp.Users.Add(new Users()
{
first_name = "test",
last_name = "test",
name = "test",
username = "test123",
email = "test123@gmail.com",
password = "test@12345"
});
</details>
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on WooCommerceNET:
Package | Downloads |
---|---|
QuickerDrivingTest-ClassLibrary
Package Description |
|
fm.WooCommerceNET.Subscriptions
Extends WooCommerceNET with support for retrieving WooCommerce Subscriptions for a user. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.8.5 | 680 | 1/4/2023 |
0.8.4 | 56,415 | 11/20/2021 |
0.8.3 | 34,849 | 3/17/2021 |
0.8.2 | 67,886 | 4/28/2020 |
0.8.1 | 5,312 | 3/4/2020 |
0.8.0 | 10,046 | 11/4/2019 |
0.7.9 | 2,444 | 9/29/2019 |
0.7.8 | 7,099 | 7/30/2019 |
0.7.7 | 5,253 | 4/2/2019 |
0.7.6-beta | 858 | 11/19/2018 |
0.7.5 | 5,333 | 6/9/2018 |
0.7.4 | 2,639 | 1/25/2018 |
0.7.3 | 10,849 | 1/7/2018 |
0.7.2 | 3,729 | 7/22/2017 |
0.7.1 | 5,976 | 5/20/2017 |
0.7.0 | 1,112 | 5/17/2017 |
0.6.1 | 5,299 | 12/15/2016 |
0.5.6-beta | 1,024 | 11/6/2016 |
0.5.5 | 1,737 | 10/22/2016 |
0.5.3-beta | 993 | 9/27/2016 |
0.5.2 | 1,573 | 9/23/2016 |
0.4.3 | 1,656 | 5/13/2016 |
0.4.1 | 1,532 | 4/14/2016 |
WooCommerce.NET is a .NET library for calling WooCommerce/WordPress REST API in .NET applications.
GitHub: https://github.com/XiaoFaye/WooCommerce.NET
Changes Doc: https://github.com/XiaoFaye/WooCommerce.NET/blob/master/Changes.md
* v0.8.5 update
1. Change all id field to 64bit integer (unsigned long) to prevent overflow. #560
2. Add WCCustomerItem for get customer by email endpoint.
3. Escape all querystrings.