Giter VIP home page Giter VIP logo

woocommerce.net's People

Contributors

acerov avatar cultti avatar dillrye avatar firestormza avatar gerald-abacus avatar gonzaloguerravicente avatar haseebmukhtar avatar jacargentina avatar osnoser1 avatar scottk4106 avatar seanonet avatar teunlielu avatar vankampenp avatar vbergara avatar xiaofaye avatar yoel-halb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

woocommerce.net's Issues

Question: Error when try a getProducts in https

I'd like to know how to make a call when using https cause I'm not sure if I'm missing somethig
I'm using the WooCommerce.NET wrapper in a console application to reatrieve the products in WooCommerce. I'm just doing a simple test for now, I've installed wordpress and woocommerce in my machine and I've tested the wrapper and everything works fine. this is my code:

string ApiUrl = "http://<local_site>/wp-json/wc/v1/";
string ApiKey = "local_site_api_key";
string ApiSecret = "local_site_api_secret";

RestAPI rest = new RestAPI(ApiUrl, ApiKey, ApiSecret);
WCObject wc = new WCObject(rest);

var myTask = wc.GetProducts();
var products = myTask.Result;

But when I try in the production site I recieve the error "The request was aborted: the connection was closed unexpectedly". I have not configured the production site so I don't know the details of the configuration, but I have de consumer key and consumer secret. I'm not making any change in my code, just the url, key and secret.

The main difference between both server is that the local server is "http" and the production server is "https" so I think there is the problem, but checking the code of the wrapper it's look like it handles this scenario (https).

The exception is thrown in the httpWebRequest.GetResponseAsync() on the wrapper.

Thank you in advance for your answer-

Orders filter mistake

Hi!
First of all thanks for the wraper.
I'm trying to get some Orders by fitering it by date, state, and including an specific ID.

`
Dictionary<string, string> parametros = new Dictionary<string, string>();

        parametros.Add("per_page", "1");
        parametros.Add("order", "asc");
        parametros.Add("after", info.FechaInicio.ToString ("2016-10-30"));           
        parametros.Add("status", "completed");
        parametros.Add("include", "950");

        RestAPI restapi = new RestAPI(ApiUrl, ConsumerKey, ConsumerSecret);
        WCObject wc = new WCObject(restapi);
        OrderList orders = Task.Run(() => wc.GetOrders  (parametros)).Result;`

But the result is that I obtain 2 orders (instead of 1 "per_page"), with creation date before "2016-10-30", the status filter is ok, but it neither has included the order 950 (that exists).

I've tried to call GetOrders with only one parameter at time and the call ignore it all, except the "status" filter.

I've get the parameter names from https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#list-all-orders

Please, could you tell me what's wrong on my code?
Thanks in advance.

How can I use it? - Error CS4033

Severity Code Description Project File Line Suppression State
Error CS4033 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. TesteCETIINFO E:\SVN\dotnetteste\trunk\Woocommerce\ConsoleApplication1\Program.cs 25 Active

`
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WooCommerceNET;
using WooCommerceNET.WooCommerce;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{

        //Legacy way of calling WooCommerce REST API
        //RestAPI rest = new RestAPI("http://www.yourstore.co.nz/wc-api/v3/", "<WooCommerce Key>", "<WooCommerce Secret");
        //WooCommerceNET.WooCommerce.Legacy.WCObject wc = new WooCommerceNET.WooCommerce.Legacy.WCObject(rest);

        RestAPI rest = new RestAPI("http://www.xyz.com/wp-json/wc/v1/", "ck_1111", "cs_1111");
        WCObject wc = new WCObject(rest);

        //Get all products
        //var products = await wc.GetProducts();
        var products = await wc.GetProducts();
        Console.WriteLine(products); 
    }
}

}

`

Products meta fields are not returned

Hello,

this one is probably due to my lack of knowledge of WP API but any help is appreciated.
I dont seem to be able to retrieve customer product file fields in json.
I doo see placeholders if i use the old wc-api/v3 but no data.

Thank You!

Meta Filter

Hello. I try to set meta filter , because I don't see meta fields

I try to do it like this

var orders = await wc.GetOrders(new Dictionary<string, string>() { { "per_page", "100" }, { "meta","true"} });

But filter not work.

How I can set meta filter?

Price property lacks decimal separator

When fetching a WooCommerce product over the API, the price property (as well as the regular_price and sale_price) misses a decimal separator. It's however not possible for me to just divide by 100 to ge the correct price. For example, the price stored in the db as 5.1 comes out as 51 through the API, similarily 39 comes out as 39.
In the database, all price values are stored with a point (.), but in the front-end I use a comma (,) as the decimal separator. I haven't had any problems with this in the frontend, nor with storing a price using the API (using UpdateProduct). It's only when fetching products this occurs.
Specifically, I have this problem when I'm updating product information form an external source. I fetch the product from the API, update something (usually) and then send the whole product back over the API. This then results in the price being changed in the database...
Could the problem be related to my frontend setting of the decimal separator, or is this a general issue?

System.Runtime.Serialization.SerializationException when geting some products from woocommerce

Hi!

I'm having a bit of a problem with geting some of the products (not all of them). This is how I do it:

var productResults = await _wolumClient.GetProduct(product.Id);

I can see the response in Fiddler and it looks like this:

{  
   "id":1923,
   "name":"Zapiski z Domu pod Ptakami Gaw\u0119dy polityczne",
   "slug":"zapiski-z-domu-pod-ptakami-gawedy-polityczne",
   "permalink":"http:\/\/nerdbase.ddns.net\/wolum-test\/produkt\/zapiski-z-domu-pod-ptakami-gawedy-polityczne\/",
   "date_created":"2016-10-16T19:00:29",
   "date_modified":"2016-10-16T19:00:29",
   "type":"simple",
   "status":"publish",
   "featured":false,
   "catalog_visibility":"visible",
   "description":"<p>Wydany obecnie tom zawiera wybrane teksty autorstwa Aleksandra Ma\u0142achowskiego drukowane w \"Wiadomo\u015bciach Kulturalnych\". Autor wybra\u0142 tylko te , kt\u00f3re wydaj\u0105 mu si\u0119 trwalsze ni\u017c normalne \u017cycie felietonowej gaw\u0119dy.Jest tu sporo komentarzy do historii wsp\u00f3\u0142czesnej, widzianej zza kulis oczyma polityka maj\u0105cego jaki\u015b wp\u0142yw na jej przebieg.<\/p>\n",
   "short_description":"<p>Wydany obecnie tom zawiera wybrane teksty autorstwa Aleksandra Ma\u0142achowskiego drukowane w &#8222;Wiadomo\u015bc&#8230;<\/p>\n",
   "sku":"30892201096KS",
   "price":"0",
   "regular_price":"0",
   "sale_price":"",
   "date_on_sale_from":"",
   "date_on_sale_to":"",
   "price_html":"<span class=\"amount\">Za darmo!<\/span>",
   "on_sale":false,
   "purchasable":true,
   "total_sales":0,
   "virtual":false,
   "downloadable":false,
   "downloads":[  

   ],
   "download_limit":-1,
   "download_expiry":-1,
   "download_type":"standard",
   "external_url":"",
   "button_text":"",
   "tax_status":"taxable",
   "tax_class":"Standard",
   "manage_stock":false,
   "stock_quantity":null,
   "in_stock":true,
   "backorders":"no",
   "backorders_allowed":false,
   "backordered":false,
   "sold_individually":false,
   "weight":"0.277",
   "dimensions":{  
      "length":"",
      "width":"",
      "height":""
   },
   "shipping_required":true,
   "shipping_taxable":true,
   "shipping_class":"",
   "shipping_class_id":0,
   "reviews_allowed":true,
   "average_rating":"0.00",
   "rating_count":0,
   "related_ids":[  
      311,
      308,
      248,
      294,
      288
   ],
   "upsell_ids":[  

   ],
   "cross_sell_ids":[  

   ],
   "parent_id":0,
   "purchase_note":"",
   "categories":[  
      {  
         "id":129,
         "name":"Biografia i wspomnienia",
         "slug":"biografia"
      },
      {  
         "id":29,
         "name":"Historia najnowsza",
         "slug":"historia-najnowsza"
      },
      {  
         "id":658,
         "name":"Historia Polski",
         "slug":"historia-polski"
      }
   ],
   "tags":[  

   ],
   "images":[  
      {  
         "id":1924,
         "date_created":"2016-10-16T19:00:29",
         "date_modified":"2016-10-16T19:00:29",
         "src":"http:\/\/nerdbase.ddns.net\/wolum-test\/wp-content\/uploads\/2016\/10\/30892201096KS-7.jpg",
         "name":"",
         "alt":"Zapiski z Domu pod Ptakami Gaw\u0119dy polityczne",
         "position":0
      }
   ],
   "attributes":[  
      {  
         "id":7,
         "name":"Oprawa",
         "position":0,
         "visible":true,
         "variation":false,
         "options":[  
            "Mi\u0119kka"
         ]
      },
      {  
         "id":8,
         "name":"Liczba stron",
         "position":0,
         "visible":true,
         "variation":false,
         "options":[  
            "264"
         ]
      },
      {  
         "id":6,
         "name":"Wydawnictwo",
         "position":0,
         "visible":true,
         "variation":false,
         "options":[  
            "Towarzystwo Wydawnicze i Literackie"
         ]
      },
      {  
         "id":5,
         "name":"Rok wydania",
         "position":0,
         "visible":true,
         "variation":false,
         "options":[  
            "1999"
         ]
      },
      {  
         "id":2,
         "name":"Autor",
         "position":0,
         "visible":true,
         "variation":false,
         "options":[  
            "Ma\u0142achowski Aleksander"
         ]
      },
      {  
         "id":4,
         "name":"ISBN",
         "position":0,
         "visible":true,
         "variation":false,
         "options":[  
            "8386610069"
         ]
      }
   ],
   "default_attributes":[  

   ],
   "variations":[  

   ],
   "grouped_products":[  

   ],
   "menu_order":0,
   "_links":{  
      "self":[  
         {  
            "href":"http:\/\/nerdbase.ddns.net\/wolum-test\/wp-json\/wc\/v1\/products\/1923"
         }
      ],
      "collection":[  
         {  
            "href":"http:\/\/nerdbase.ddns.net\/wolum-test\/wp-json\/wc\/v1\/products"
         }
      ]
   }
}

JSON is correct, I don't see any other issues with this data, but I still get:

System.Runtime.Serialization.SerializationException : There was an error deserializing the object of type WooCommerceNET.WooCommerce.Product. Input string was not in a correct format. ----> System.FormatException : Input string was not in a correct format.

What am I doing wrong?

Update Order Error

Hi again!

I'm trying to Update an Order state using the code below:

RestAPI restapi = new RestAPI(ApiUrl, ConsumerKey, ConsumerSecret); WCObject wc = new WCObject(restapi); string result = await wc.UpdateOrder (oid, new Order { id= oid , status= "cancelled", updated_at = DateTime.Now });

Oid is an existing order Id. As you see I use a similar code like the Update Product Example in the Usage section (await wc.UpdateProduct(128, new Product { name = "test 9" });)

I also tried this other version

Dictionary<string, string> parametros = parametros = new Dictionary<string, string>(); parametros.Add("status", "cancelled"); RestAPI restapi = new RestAPI(ApiUrl, ConsumerKey, ConsumerSecret); WCObject wc = new WCObject(restapi); string result = await wc.UpdateOrder (oid, new Order { id= oid }, parametros);
In both cases the result is the same: the order isn't update and I get the result below:

"
\nWarning: urldecode() expects parameter 1 to be string, array given in /homepages/24/d582332844/htdocs/clickandbuilds/jolieboutique/wp-content/plugins/woocommerce/includes/api/legacy/v1/class-wc-api-server.php on line 401
\n{"order":{"id":959,"order_number":959,"created_at":"2016-10-26T11:36:00Z","updated_at":"2016-10-26T13:31:14Z","completed_at":"2016-10-26T12:31:14Z","status":"trash","currency":"EUR","total":"151.60","subtotal":"143.70","total_line_items_quantity":3,"total_tax":"0.00","total_shipping":"7.90","cart_tax":"0.00","shipping_tax":"0.00","total_discount":"0.00","cart_discount":"0.00","order_discount":"0.00","shipping_methods":"Env\u00edo","payment_details":{"method_id":"","method_title":"","paid":false},"billing_address":{"first_name":"","last_name":"","company":"","address_1":"","address_2":"","city":"","state":"","postcode":"","country":"","email":"","phone":""},"shipping_address":{"first_name":"a","last_name":"b","company":"c","address_1":"","address_2":"","city":"","state":"","postcode":"","country":"ES"},"note":"test notes here","customer_ip":"","customer_user_agent":"","customer_id":"0","view_order_url":"http://jolie-boutique.es/my-account/view-order/959","line_items":[{"id":35,"subtotal":"45.90","total":"45.90","total_tax":"0.00","price":"45.90","quantity":1,"tax_class":null,"name":"Camiseta Blanca de Lentejuelas","product_id":519,"sku":"camisetablancalentuejuelasS"},{"id":36,"subtotal":"34.90","total":"34.90","total_tax":"0.00","price":"34.90","quantity":1,"tax_class":null,"name":"Pantal\u00f3n Negro","product_id":464,"sku":"pantanegro"},{"id":37,"subtotal":"62.90","total":"62.90","total_tax":"0.00","price":"62.90","quantity":1,"tax_class":null,"name":"Vestido de flores rojas","product_id":593,"sku":"Vestido de flores rojas XL"}],"shipping_lines":[{"id":38,"method_id":"flat_rate","method_title":"","total":"7.90"}],"tax_lines":[],"fee_lines":[],"coupon_lines":[],"customer":{"id":0,"email":"","first_name":"","last_name":"","billing_address":{"first_name":"","last_name":"","company":"","address_1":"","address_2":"","city":"","state":"","postcode":"","country":"","email":"","phone":""},"shipping_address":{"first_name":"a","last_name":"b","company":"c","address_1":"","address_2":"","city":"","state":"","postcode":"","country":"ES"}}}}"

Please, could you tell me what's wrong ?
Thanks in advance.

User's auth and items variations

I want to cross your WooCommerce component with another WordPress. Does it'll work with WordPress auth correctly?

As well does it working properly with variable product in Cyrylic language?

There is an error in price format

on woocomerence we can choose decimal separator, and it produce an error when we change it
should be:
pi.SetValue(this, decimal.Parse(value.ToString().Replace(".",",")))
instead of:
pi.SetValue(this, decimal.Parse(value.ToString()))

Connection Challenges

I cannot seem to get past the "401" error indicating authentication issues. I've:

1.) Using HTTPS
2.) Deleted and recreated the API key pairs in WOOCommerce and verified they are correct in the C# code
3.) Tested with GetStoreInfo which returns lots of data successfully
4.) All other calls to routines like GetCustomers() / GetProducts() all fail with a 401 error
5.) Traced the call into RestAPI.cs / SendHttpClientRequest and I see the httpWebRequest.Credentials appear to be created correctly (username & password contain the api keys)
6.) The user profile assigned to the API key pairs is an "admin" level account

Any idea of where I might be going wrong?
Thanks!
Mike

Mange_stock and price

manage_stock property of variation has a type of string and is not working correctly for me. When I changed it in your code to bool it started working.

I can't get regular_price of variation to work - it is not going through, and fiddler is not even showing it in request JSON. Can you check if it is working for you?

How to add Category and Tags with the product?

Hi!
Here is example a code:
... <create product object (pr) >

        pr.categories = new CategoryList();
        WooCommerceNET.WooCommerce.Category cat = new Category();
        cat.name=gd.goodType.name.ToString() + "/" + gd.goodKind.name.ToString() + "/" + gd.goodKindValue.name.ToString();
        pr.categories.Add(cat);

        pr.tags = new TagList();
        Tag tg1 = new WooCommerceNET.WooCommerce.Tag();
        tg1.name= gd.goodType.name.ToString();
        pr.tags.Add(tg1);

        Tag tg2 = new WooCommerceNET.WooCommerce.Tag();
        tg2.name = gd.goodKind.name.ToString();
        pr.tags.Add(tg2);

        Tag tg3 = new WooCommerceNET.WooCommerce.Tag();
        tg3.name = gd.goodKindValue.name.ToString();
        pr.tags.Add(tg3);

...

No tags and no categories appear with the product after publish in WooCommerce. Probably I do something wrong?
Thanks in advance.

Null reference error

I don't know if this is a bug or a usage problem, but every time I try to execute a request (GetCustomer, GetOrder, UpdateOrder), I am getting a Null Reference Error.

Here's a snippet of my code (the url, key, and secret are all initialized strings):
try
{
RestAPI rest = new RestAPI(wc_url, wc_key, wc_secret);
WCObject wc = new WCObject(rest);

            Customer cust = await wc.GetCustomer(1);

null reference error

update featured product

string response = await wc.UpdateProduct(1, new Product() { featured= false}); doesn't work but with true value works fine. I read the documentation, but there is nothing.

Create webhook

Hi

Any plans for adding support for creating webhooks?

John

Product object taking in has the category object

WooCommerceNET.WooCommerce.Product

    /// <summary>
    /// List of categories. See Categories properties.
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public CategoryList categories { get; set; }

this should be ProductCategoryList

the categorylist works until you need to add something more than the name and slug, the other fields like parent are not required

Batch with V1

Try to use V1 (new REST API version), but UpdateProducts is not working

 public async Task<string> UpdateProducts(Product[] ps, Dictionary<string, string> parms = null)
        {
            return await API.SendHttpClientRequest("products/batch", RequestMethod.PUT, ps, parms);
        }

response with empty json, because batch waiting something like this:

var data = {
  create: [
    {
      name: 'Woo Single #1',
    },
    {
      name: 'New Premium Quality',
      type: 'simple',
      regular_price: '21.99',     
    }
  ],
  update: [
    {
      id: 165,
      variations: [
        {
          id: 170,
          regular_price: '29.99'
        },
        {
          id: 172,
          regular_price: '29.99'
        }
      ]
    }
  ],
  delete: [
    162
  ]
};`

But there are only Products in the request body

Thank you if you will fix this.

GetOrders error

Hello.

I try to receive all order like this:

var orders = await wc.GetOrders();
            foreach (var order in orders)
            {



                Debug.WriteLine($"ID:{order.id}");

But I see only first 10 orders in console. But in admin panel I see about 28 orders.

Cannot display shipping adress

Hello again.

I try to display orders.shipping but I have this Adress: WooCommerceNET.WooCommerce.ShippingAddress

How I can receive text from orders,shipping?

UpdateProduct response when save Tags

Product Tags is not save when use UpdateProduct()
Tags is a List<object>
response is always: "{\"product\":{...,\"tags\":[],...}}"

 public async Task<string> UpdateProduct()
        {
            rest = new RestAPI("site, ck, cs");


            WCObject wc = new WCObject(rest);
            string result="";                      
            try
            {

                //result = await wc.UpdateProduct((int)id, product); -- good except tags
                //result = await wc.UpdateProduct((int)id, new Product { tags = Tags, name=Name, title=Title } ); -- good except tags
                result = await wc.UpdateProduct((int)product.id, new Product { tags = Tags }); -- do "nothing"
            }

            catch (Exception)
            {
                return "Cannot connect";
            }
            return result;

        }

sku field

how to save and update sku field?

DeserializeJSon Error by using latest API

Used Plugin:wp-json/wc/v1/
WooCommerce.Net 0.5.1
Wordpress Version 4.6.1
WooCommerce 2.6.4

It stuck on API.DeserializeJSon(json)

There was an error deserializing the object of type WooCommerceNET.WooCommerce.ProductList. The value '' cannot be parsed as the type 'decimal'.

But using the wc-api/v3/, it's ok.

WooCommerceNET says error deserializing OrderList: Value can not be parsed as a decimal value.

My WooCommerce shop (version 2.6.4), when I use the GetOrders API call, it often sends me an OrderList (JSON) that contains "shipping_lines" that look like:
"shipping_lines":[{"id":4,"method_title":"Flat Rate","method_id":"flat_rate:2","total":"0.00","total_tax":"0.00","taxes":[{"id":1,"total":""}]}]

It contains a "taxes" array that has a total value written like an empty string. This gives an exception saying that the value cannot be parsed as a decimal value.
If I repair the total manually by typing "0.00" then the exception disappears.
I am using the newest 0.5.5 version of the WooCommerceNET library.
What's wrong? Is WooCommerce 2.6.4 having a bug, or is WooCommerceNET too restrictive in not allowing a "". Or am I using a wrong mix of versions...? How can I get rid of the exception?

woocommerce_rest_authentication_error

I am using this same solution on 3 different websites, and from the same method i randomly get:

{"code":"woocommerce_rest_authentication_error","message":"Invalid Signature - provided signature does not match.","data":{"status":401}}

other times it is working fine,
i have verified that the url and keys are correct when this happens.

I cant reproduce this as it happens randomly

Cannot connect to my webshop anymore

Hey,

Since a while I can't connect anymore to my webshop.
It has worked for a couple months just fine.

I try this:

`var woocommerceApiClient = new WoocommerceApiClient("http://solideogloria.nl/", "ck_6abbd76a97dc245eed7c4e6bf6572e48983c557f", "cs_cee0aaa2bcd42e5a790b75a7d89576d80292ee9a");

var importedProductsParameters = new WoocommerceParameters();
importedProductsParameters.AddFilterLimit(1000);
var importedProducts = woocommerceApiClient.Products.Get(importedProductsParameters);
`

Can u see whats wrong?
I created this keys for u to test it.
I hope u can help me.

Thanks.

Json DeSerialize at release mode through exception

Exception name :- System.RuntimeType doesn't contain a definition for Declared PropertiesPlease remove dynamic keyword in next release of nuget package instead dynamic if we use Type dt = typeof(T);
if (dT.Name.EndsWith("List"))
dT = dT.GetTypeInfo().DeclaredProperties.First().PropertyType.GenericTypeArguments[0];its working finepublic T DeserializeJSon(string jsonString)
{
dynamic dT = typeof(T);

    if (dT.Name.EndsWith("List"))
        dT = dT.DeclaredProperties[0].PropertyType.GenericTypeArguments[0];//Throughing Exception at this point

    DataContractJsonSerializerSettings settings = new DataContractJsonSerializerSettings()
    {
        DateTimeFormat = new DateTimeFormat(DateTimeFormat),
        UseSimpleDictionaryFormat = true
    };
    DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T), settings);
    MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(jsonString));
    T obj = (T)ser.ReadObject(stream);
    stream.Dispose();

    return obj;
}`

solution is

Null reference exception while add pic with good

Hi,
Probably I'm do womething wrong, but when I'll try to add link to picture together with new good, I have the follofing:
null-ref-woo

This is issue or I do ot wrong way? Please give a path to fix that. Thanx in advance.

Legacy not working

For example on GetProduct :

Error :
There was an error deserializing the object of type WooCommerceNET.WooCommerce.Legacy.Product. The value 'parent' cannot be parsed as the type 'Boolean'.

InnerException :
{"The string 'parent' is not a valid Boolean value."}

at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(Stream stream)
at WooCommerceNET.RestAPI.DeserializeJSon[T](String jsonString)
at WooCommerceNET.WooCommerce.Legacy.WCObject.d__33.MoveNext()

Legacy WCObject

Hi, everyone...
I´m trying to use the method "GetProducts", but when I try this:
WCObject wc = new WCObject(rest);
I get this message: "You can't use the legacy WCObject on the latest version of WooCommerce Restful API."

What I doing wrong?? Is a issue in my code or something in config of wordpress??

Thanks!

Error: 500 internal error.

This seems like a consistent error, so i will post it.
I can post a product normally and it will work fine, the first time. The second time, it will return an error containing the html of the website where it has a 500 internal error.

Update product images

Hi,
I'm trying to update a product and in particular the images, using the following code:

           ImageList productImagesList = new ImageList();
           Image img = new Image()
           ...
           productImagesList.Add(img);
           img = new Image()
           ....
           productImagesList.Add(img);

            Product newP = new Product()
            {
                sku = drArtigo["art"].ToString(),
                slug = drArtigo["art"].ToString(),
                name = drArtigo["Desig"].ToString(),
                short_description = drArtigo["Desig"].ToString(),
                description = drArtigo["Detalhes"].ToString(),
                regular_price = drArtigo["PV"].toDecimal(),
                sale_price = drArtigo["PV"].toDecimal(),
                price_html = drArtigo["PV"].toDecimal().ToString("C2"),
                in_stock = true,
                categories = categoriesList,
                images = productImagesList
            };
            int pid = (int)product.id;
            string json = await _wooObject.UpdateProduct(pid, newP);

But in the product remain the first images sent when the product creation. I take a look to the json string returned from the server and images source remains the old one, do not update to new source url send with product update.
What am I doing wrong?

Get seller information

Hi,

We're using Dokan multivendor shops.
Is there a way to read who the seller of a product is through your wrapper? Or who the seller in an order is?

If there are currently no way of doing that, I hope you would consider putting that into your API.
Excellent work by the way!

Thanks!

authentication_error when using "before" or "after" criterion on WC.GetOrders(...)

If I call the WCObjects "GetOrders" method with either the "after" parameter or the "before" parameter then I get an Authentication Exception that says the signature is not valid.
For instance if I do the following, I get the exception:

        OrderList ol = await WcObject.GetOrders(new Dictionary<string, string>()
        {
            ["after"] = new DateTime(2016, 9, 30).ToString("yyyy-MM-ddThh:mm:ss"),
        });

When I do this, I also get the exception:

        OrderList ol = await WcObject.GetOrders(new Dictionary<string, string>()
        {
            ["before"] =  new DateTime(2016, 10, 30).ToString("yyyy-MM-ddThh:mm:ss"),
        });

Many other combinations of parameters work correctly, for instance:

        OrderList ol = await WcObject.GetOrders(new Dictionary<string, string>()
        {
            ["status"] = "processing",
            ["context"] = "view",
            ["per_page"] = "100"
        });

This gives me a valid list of orders.
Therefore I think there cannnot be anything wrong with my credentials. If something was wrong, all requests should fail, I guess?
How can I fix it? Being able to select on DateTime is a bit essential.
(I am on version 0.5.5)

Update Order

Hello. I want to ask.

Can I update order with adding my json value to order?

woocommerce_rest_authentication_error

I am using v1 and when i tried to get orders, I have this error:

RestAPI rest = new RestAPI(_cred.Url, _cred.ConsumerKey, _cred.ConsumerSecret);
WooCommerceNET.WooCommerce.Legacy.WCObject wc = new WooCommerceNET.WooCommerce.Legacy.WCObject(rest);
Task<WooCommerceNET.WooCommerce.Legacy.OrderList> task = System.Threading.Tasks.Task.Run(() => wc.GetOrders());
 var response = task.GetAwaiter().GetResult();

{"code":"woocommerce_rest_authentication_error","message":"Invalid Signature - provided signature does not match.","data":{"status":401}}

But i was able to get the orders using Postman with this URL:
http://xxx.com/wc-api/v3/orders?oauth_consumer_key=ck_xxx41a3dd1d4b0b9b519c96d8fe621d783cd12xx&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1478511461&oauth_nonce=Q68pPF&oauth_version=1.0&oauth_signature=9bdz2m6oCFiqoTIHU70PHdifKhU=

What could be the possible cause of this one? Thanks

Product Image Upload

Hi,
I'm having a problem to POST a Product when the image souce is local PC.

When i use this code it works nice
image.src = (@"http://www.mydomain.com/imagesstore/imagetest.jpg"),

But when i try a local url like this
src = (@"file:///C:/TEMP/LOCALIMAGES/imagetest.jpg")
always return {"{"code":"woocommerce_product_image_upload_error","message":"Error getting remote image . Error: Not a valid URL has been specified..","data":{"status":400}}"}

I can not use a local URL?
I have to first upload the images with FTP client to the server to use it in the POST product ?
Thanks ,
Marcos

Products and ProductCategories Filter

I'm not able to get Products or ProductCategory with a particular filter.
I need to get the productcategories that are equal a "Cars".
I tried this code, but does not work, wil return all productcategories.

RestAPI rest = new RestAPI("http://www.yourstore.co.nz/wp-json/wc/v1/", "", "<WooCommerce Secret");
WCObject wc = new WCObject(rest);
// Create filter parameters
var filtro = new Dictionary<string, string>() { { "fields", "name" }, { "filter[equal]", "Cars" }};
// Get Product Categories
var cat = await wc.GetProductCategories(filtro);

Thanks,
Marcos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.