-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Add Sale price validation #38078
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
Add Sale price validation #38078
Conversation
|
Hi @joshuatf, 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: |
Test Results SummaryCommit SHA: ff88a41
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. |
joshuatf
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.
Code looks great! I like the separation of these into two blocks. Left a couple comments and a quick question on the help expectations.
Also, should we remove the old woocommerce/product-pricing-field block or is this still needed?
|
|
||
| const regularPriceValidationError = useValidation( | ||
| 'product/regular_price', | ||
| function nameValidator() { |
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.
| function nameValidator() { | |
| function regularPriceValidator() { |
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. Done -> ff88a41
|
|
||
| const salePriceValidationError = useValidation( | ||
| 'product/sale_price', | ||
| function nameValidator() { |
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.
| function nameValidator() { | |
| function salePriceValidator() { |
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.
Done -> ff88a41
| setValue: setRegularPrice, | ||
| } ); | ||
|
|
||
| const interpolatedHelp = help |
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.
I don't see help currently being used. Do we have plans to use this in the future?
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.
Yes it is. See the next line
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.
I can see it used in this component, but was curious if this was being actively passed as an attribute to this component.
I see now that a help attribute is being passed in the PR merged in last week so this looks good. 👍
joshuatf
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.
Sorry for the delay in follow-up review. This LGTM! 🚢
| setValue: setRegularPrice, | ||
| } ); | ||
|
|
||
| const interpolatedHelp = help |
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.
I can see it used in this component, but was curious if this was being actively passed as an attribute to this component.
I see now that a help attribute is being passed in the PR merged in last week so this looks good. 👍
Submission Review Guidelines:
Changes proposed in this Pull Request:
Closes #37985
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
/wp-admin/tools.php?page=woocommerce-admin-test-helperproduct-block-editor/wp-admin/admin.php?page=wc-admin&path=/add-productGeneraltab and withinBasic detailssection the product list price and sale price should validate according the AC described in Product Block Editor: Add Sale price validation #37985