XiaoFaye / WooCommerce.NET

A .NET Wrapper for WooCommerce/WordPress REST API
MIT License
391 stars 217 forks source link

Duplicate Products !? #763

Closed nikolamarkovic1987 closed 10 months ago

nikolamarkovic1987 commented 11 months ago

Using approach to retrieve all the Products: https://github.com/XiaoFaye/WooCommerce.NET/issues/83 i am getting the right number of products (4010) but when i sort them i can see that some of the products are having 4-5 same entries. I have check in the database and there is only one entry with this name.

I have changed product number, it made more iterations but in the end, it does not make a difference if i set 100 or 20 products per page.

nikolamarkovic1987 commented 11 months ago

as i can see, the number of pages is good 401 and based on that is shall return 100per page, but somehow i am getting duplicates when adding retrieved products into list. I have also removed "per_page" property, it last much longer and i still got the same results.... any advice ?

nikolamarkovic1987 commented 10 months ago

I have found a solution (but forgot to mention it here) adding additional key-value pair (orderby - id) into parameter helped.

            var dic = new Dictionary<string, string>
            {
                { "per_page", "100" },
                { "page", pageNumber.ToString() },
                { "orderby", "id" }
            };