Skip to content

Commit

Permalink
Add extension method DeleteTaxClass for deleting TaxClass. #576
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoFaye committed Mar 10, 2021
1 parent 3095a93 commit 04a1374
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions WooCommerce/v3/WCObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,20 @@ public static async Task<Currency> GetCurrency(this WCItem<Data> item, string cu
{
return item.API.DeserializeJSon<Currency>(await item.API.GetRestful(item.APIEndpoint + "/currencies/" + currency, null).ConfigureAwait(false));
}

public static async Task<TaxClass> DeleteTaxClass(this WCItem<TaxClass> item, string slug, bool force = false, Dictionary<string, string> parms = null)
{
if (force)
{
if (parms == null)
parms = new Dictionary<string, string>();

if (!parms.ContainsKey("force"))
parms.Add("force", "true");
}

return item.API.DeserializeJSon<TaxClass>(await item.API.DeleteRestful(item.APIEndpoint + "/" + slug, parms).ConfigureAwait(false));
}
}

}

0 comments on commit 04a1374

Please sign in to comment.