WooCommerce.NET icon indicating copy to clipboard operation
WooCommerce.NET copied to clipboard

Cannot Retrieve certain products using dictionary

Open chrisvell88 opened this issue 3 years ago • 1 comments

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 avatar Mar 30 '22 13:03 chrisvell88

Hi, any update on this issue please??

chrisvell88 avatar Apr 11 '22 09:04 chrisvell88

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

FabPari avatar Oct 02 '22 20:10 FabPari

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: @.***>

chrisvell88 avatar Oct 03 '22 13:10 chrisvell88

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

XiaoFaye avatar Oct 08 '22 05:10 XiaoFaye