Closed marcusorjames closed 3 years ago
Hi @marcusorjames,
Thank you for opening the issue! It requires further feedback from the WooCommerce Core team. I am adding the needs developer feedback
label to this issue so that the Core team could take a look.
Please note it may take a few days for them to get to this issue. Thank you for your patience.
Hi, I have transferred this issue to blocks repo which should be the correct team to answer this query.
Hi there @marcusorjames,
could you provide some steps for this step Put a specific Product data in an invalid state
.
I tried different things and I was not able to reproduce.
Hi @marcusorjames,
We're still waiting additional details to help us with reproducing your issue, since we haven't received a response in a while and there currently isn't anything actionable for us I'm going to go ahead and close this issue. However, if you leave a comment with the additional information we're looking for and we're able to reproduce we will re-open. Thanks for taking the time to leave the original report!
Please provide us with the information requested in this bug report. Without these details, we won't be able to fully evaluate this issue. Bug reports lacking detail, or for any other reason than to report a bug, may be closed without action.
Prerequisites (mark completed items with an [x]):
Describe the bug When using the rest api to fetch products if the database returns an invalid response then it fails the entire response.
Expected behavior Up for discussion. Should a failed product query fail the entire response, or should it handle it and continue
Actual behavior Currently in
/packages/woocommerce-blocks/src/StoreApi/Routes/Products.php
The product_query will return an empty array item on a failed product lookup, this then means that in
ProductSchema::get_item_response
$product->get_id()
fatals because $product is not a product.The problem that I have is that it breaks the entire response and doesn't give any indications of the particular product which is causing the failure. Checking whether
$object
above is an object and continuing otherwise fixes the issue for now, but it is just brushing it under the rug. I am unsure of the standards in woo commerce in how to handle an invalid data state, but to me failing the entire response is not ideal.Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.) Steps to reproduce the bug:
wp-json/wc/store/products?per_page=100&catalog_visibility=any&search=&orderby=title&order=asc&_locale=user
Screenshots If applicable, add screenshots to help explain your problem.
Isolating the problem (mark completed items with an [x]):
WordPress Environment We use the WooCommerce System Status Report to help us evaluate the issue. Without this report we won't be able to fully evaluate this issue.