This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 218
Prevent Featured Product
block from breaking when product is out of stock + hidden from catalog
#6166
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
albarin
added
type: bug
The issue/PR concerns a confirmed bug.
focus: blocks
Specific work involving or impacting how blocks behave.
block: featured product
Issues related to the Featured Product block.
labels
Mar 30, 2022
rubikuserbot
requested review from
a team and
tomasztunik
and removed request for
a team
March 30, 2022 14:56
By default, the `/wc/store/v1/products` endpoint does not return products with `outofstock` stock status. We want the users to be able to select any product regardless of its stock status, we need to explicitly request them using the `stock_status` query param.
albarin
force-pushed
the
fix/5344-feature-product-bug
branch
from
March 30, 2022 14:58
1af1e24
to
3dbb452
Compare
Size Change: +478 B (0%) Total Size: 862 kB
ℹ️ View Unchanged
|
tomasztunik
suggested changes
Mar 31, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as advertised! :)
Minor improvement opportunity and some extra thoughts on handling hidden products.
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
tomasztunik
approved these changes
Mar 31, 2022
tjcafferkey
pushed a commit
that referenced
this pull request
Apr 5, 2022
… stock + hidden from catalog (#6166) * Prevent accessing the first element of the `parentProduct` array if empty * Include all products regardless of their `stock_status` By default, the `/wc/store/v1/products` endpoint does not return products with `outofstock` stock status. We want the users to be able to select any product regardless of its stock status, we need to explicitly request them using the `stock_status` query param. * Use the optional chaining operator Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
tarhi-saad
added a commit
that referenced
this pull request
Apr 14, 2022
tarhi-saad
added a commit
that referenced
this pull request
Apr 14, 2022
tarhi-saad
added a commit
that referenced
this pull request
Apr 14, 2022
* Empty commit for release pull request * Add Changelog to readme.txt * Update WC tested and required versions * Add testing notes * Register missing C&C inner blocks and update fallback template for older C& C versions (#6195) * Register missing C & C inner blocks and update fallback template for older C & C versions This will fix the issues with missing order summary inner blocks: Coupons (both in C & C blocks) and the Cart header. The issue was happening because, for example, for Cart the coupons were registred on the on frontend, but it just wasn't forced in the attributes. Because it also wasn't added to the PHP fallback layout, the render function didn't include it. For the Checkout block the coupons inner block wasn't registered at all. * Revert changes to Checkout.php, we don't need to test for inner blocks * Revert "Revert changes to Checkout.php, we don't need to test for inner blocks" This reverts commit fc39535. * Fix the returned template for older Checkout block iterations * Fix Cart and Checkout templates to accommodate the Summary order inner blocks * Hide coupon form div from inner blocks if coubons are not enabled * Fix checkout coupon tests in checkout They have been written for logged in user * Fix Order Summary Heading inner block's default text * Update comments with better wording * Revert "Hide coupon form div from inner blocks if coubons are not enabled" This reverts commit ab09021. (cherry picked from commit 40180ae) * Update the zip file link * Update testing instructions * Remove experimental build related PR from testing notes * Fix/order summary sidebar css (#6231) * Add box sizing to Totals item * Add some unit tests for Order summary blocks * Fix Proceed to checkout button size (cherry picked from commit 669aee7) * Update the WC required/tested versions * Mini Cart Contents: Use block pattern to make the empty cart message translatable (#6248) * try: use block pattern to make empty cart message translatable * Update src/BlockTypes/MiniCart.php Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com> * rename function Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com> Co-authored-by: Luigi <gigitux@gmail.com> (cherry picked from commit cfe73f1) * Update the release's ZIP file * Update testing notes In #6065, for Cart only Order Summary Heading & Coupon form can be removed, and for Checkout only the Coupon form. * Update the testing notes Remove #5870 testing notes because they can't be tested as a user * Update Testing notes Add screenshots to the #5967 testing notes * Remove #6166 testing instructions We reverted this PR * Revert (#6166) (#6253) Revert "Prevent Featured Product block from breaking when product is out of stock + hidden from catalog (#6166)" This reverts commit 3c0e0af (cherry picked from commit 908526e) * Bumping version strings to new version. Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Saad Tarhi <saad.trh@gmail.com> Co-authored-by: Raluca Stan <ralucastn@gmail.com> Co-authored-by: Luigi Teschio <gigitux@gmail.com> Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
block: featured product
Issues related to the Featured Product block.
focus: blocks
Specific work involving or impacting how blocks behave.
type: bug
The issue/PR concerns a confirmed bug.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a product is
out of stock
and hidden from the catalog, it is not returned from the/wc/store/v1/products
endpoint (which is used on theFeatured Product
block to display the list of available products).This causes the block to break when editing a
Feature Product
block configured with anout of stock
product since it tries to find the selected product on the array returned from the endpoint and on the variations, but it's not there.This PR prevents accessing to the
parentProduct
array when it's empty (which was causing the JS error) and also uses thestock_status
query param on the/products
endpoint to explicitly request all products regardless on their statuses.Fixes #5344
Testing
Manual Testing
Changelog