You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
products shows in debug console but gives error on screen.
When I debug, it directs me to WooProduct - totalSales in the package.
Please Any help. Thanks
The text was updated successfully, but these errors were encountered:
I also faced the same issue while fetching the products. final fetchedProducts = await woocommerce.getProducts( orderBy: 'price', order: 'asc', );
After digging into the problem, I found out the issue lies in the fetched response from the Woocommerce API.
In JSON response from API, the type of total_sales for every product was int, as expected. Except for one whose, total_sales value was of type String, "0".
In my case, that product was a draft with no SKU (this is not a confirmed scenario, other products with the same config were working fine), so I added SKU and published it and afterward, the API started giving the correct response.
For now, you may check the product configuration, until this issue is fixed on the API side or check is added into the plugin.
class WooCommerceApi {
WooCommerce prodMode = WooCommerce(
baseUrl: Config.url,
consumerKey: Config.key,
consumerSecret: Config.secret,
isDebug: true,
);
Future<List> getProductsRealDomain() async {
final dynamic myProducts = await prodMode.getProducts();
print("WooCommerceApi === getProducts1 : ${myProducts.length}");
return myProducts;
}
}
products shows in debug console but gives error on screen.
When I debug, it directs me to WooProduct - totalSales in the package.
Please Any help. Thanks
The text was updated successfully, but these errors were encountered: