XiaoFaye / WooCommerce.NET

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

Cannot Retrieve certain products using dictionary #688

Closed chrisvell88 closed 1 year ago

chrisvell88 commented 2 years ago

Make sure you have included the below details when open an issue. Thank you.

Hi,

I am using the code below to retrieve products. Strangely enough on certain items, searching by SKU returns the following error. I have compared these items to items which work using the same code and there is no evident difference between them. We are using the latest version of Wordpress & Woocommerce.

Dictionary<string, string> pDic = new Dictionary<string, string>(); pDic.Add("sku", txtBarcode.Text);

                RestAPI rest = new RestAPI("https://URL/wp-json/wc/v2/", App.WooCons, App.WooSec);
                WCObject wc = new WCObject(rest);

                App.wooProducts = await wc.Product.GetAll(pDic); //ERROR HAPPENING ON THIS LINE

ERROR:

Fatal error: Uncaught Error: Call to a member function get_attributes() on bool in /public_html/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:463

I would appreciate your urgent assistance on the matter.

chrisvell88 commented 2 years ago

Hi, any update on this issue please??

FabPari commented 2 years ago

Try to connect to yourwebsite.com/wp-json/wc/v3/

chrisvell88 commented 2 years ago

Hi Fabio,

Tried that but still the same

On Sun, Oct 2, 2022 at 10:23 PM Fabio Parigi @.***> wrote:

Try to connect to yourwebsite.com/wp-json/wc/v3/

— Reply to this email directly, view it on GitHub https://github.com/XiaoFaye/WooCommerce.NET/issues/688#issuecomment-1264725869, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL4XB2KPAVZOLZ4YYOVWVPLWBHVNDANCNFSM5SB34KKA . You are receiving this because you authored the thread.Message ID: @.***>

XiaoFaye commented 2 years ago

It's likely one of your plugins causing this problem.