-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Adding Stock status to inventory tab and toggle block #37906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test Results SummaryCommit SHA: 2e4d857
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
e3f71e8 to
e616d28
Compare
|
Hi @mdperez86, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
mdperez86
left a comment
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.
Nice job here @joelclimbsthings I just left 2 comments about the block naming convention.
packages/js/product-editor/src/blocks/inventory-quantity/block.json
Outdated
Show resolved
Hide resolved
|
Thanks @mdperez86 , good call! I've remedied the block names in 41c7227. |
mdperez86
left a comment
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.
LGTM @joelclimbsthings !!
This PR needs a rebase. Ping me when ready to go.
41c7227 to
cdd630c
Compare
mdperez86
left a comment
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.
Nice job here @joelclimbsthings
cdd630c to
289cc5e
Compare
mdperez86
left a comment
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.
Yep, we always forget server side registration.
You mentioned in my PR so don't forget to add new blocks in the server side too.
https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/BlockRegistry.php#L22
| "apiVersion": 2, | ||
| "name": "woocommerce/product-track-inventory-fields", | ||
| "title": "Product track inventory fields", | ||
| "name": "woocommerce/product-inventory-quantity-field", |
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.
| { | ||
| "$schema": "https://schemas.wp.org/trunk/block.json", | ||
| "apiVersion": 2, | ||
| "name": "woocommerce/product-toggle-field", |
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.
|
Thanks @mdperez86 , added in 2e4d857 |
mdperez86
left a comment
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.
Nice job @joelclimbsthings thanks for such great work here this LGTM!!!
Submission Review Guidelines:
Changes proposed in this Pull Request:
Adds stock status to product block editor inventory section.
I also ended up refactoring a previous inventory fields block and adding a generic toggle block.
Closes #37884 .
How to test the changes in this Pull Request:
Checkout branch and enable
product-block-editorfeature flag using WCA Test Helper.Navigate to Products -> Add new to see new product block editor.
Add a name to the product.
Go to Inventory tab.
With "track stock quantity" toggle disabled, you should see the "Stock status" radio field.

Select a different option, refresh, and ensure that your selection persists.
Enable the "track stock status" toggle above.
The "Stock status" radio should disappear and now display the "available quantity" field.
Ensure values for both of those fields also persist when saving and refreshing.