İlgili site Wolmart teması kullanmakta. WooCommerce API ile ürün girişi yaptıracağım ancak ilgili tema kendi brand taksonomisini kullanıyor ve ürün oluştururken brand girmeyi bir türlü beceremedim.
Temanın kendi brand özelliği kullanılacaktır. Ayrı bir plugin istenmiyor.
Örnek RestSharp isteği;
var options = new RestClientOptions("https://xxx.com")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/wp-json/wc/v3/products", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Basic xxx");
var body = @"{
" + "\n" +
@" ""name"": ""Premium Quality"",
" + "\n" +
@" ""type"": ""simple"",
" + "\n" +
@" ""regular_price"": ""21.99"",
" + "\n" +
@" ""description"": ""Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo."",
" + "\n" +
@" ""short_description"": ""Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas."",
" + "\n" +
@" ""categories"": [
" + "\n" +
@" {
" + "\n" +
@" ""id"": 173
" + "\n" +
@" }
" + "\n" +
@" ],
" + "\n" +
@" ""product_brand"": [
" + "\n" +
@" {
" + "\n" +
@" ""name"": ""can""
" + "\n" +
@" }
" + "\n" +
@" ]
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);Kısaca bu tema için nasıl brand gönderileceğini çözmem gerekiyor.Çözebilecek kişiler fiyatıyla birlikte PM atabilirler.
İyi çalışmalar.