Skip to content

Conversation

@mdperez86
Copy link
Contributor

@mdperez86 mdperez86 commented May 2, 2023

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:

  1. Got to /wp-admin/tools.php?page=woocommerce-admin-test-helper
  2. Under Features tab make sure to enable product-block-editor
  3. Then visit /wp-admin/admin.php?page=wc-admin&path=/add-product
  4. Under General tab and within Basic details section the product list price and sale price should validate according the AC described in Product Block Editor: Add Sale price validation #37985

@mdperez86 mdperez86 requested a review from a team May 2, 2023 17:28
@mdperez86 mdperez86 self-assigned this May 2, 2023
@github-actions github-actions bot added focus: react admin [team:Ghidorah] plugin: woocommerce Issues related to the WooCommerce Core plugin. labels May 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 2, 2023

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:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@github-actions
Copy link
Contributor

github-actions bot commented May 2, 2023

Test Results Summary

Commit SHA: ff88a41

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests26700202690m 53s
E2E Tests1870010019716m 24s

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.

Copy link
Contributor

@joshuatf joshuatf left a 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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function nameValidator() {
function regularPriceValidator() {

Copy link
Contributor Author

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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function nameValidator() {
function salePriceValidator() {

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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. 👍

@mdperez86 mdperez86 requested a review from joshuatf May 3, 2023 18:22
Copy link
Contributor

@joshuatf joshuatf left a 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
Copy link
Contributor

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. 👍

@mdperez86 mdperez86 merged commit c265db9 into trunk May 8, 2023
@mdperez86 mdperez86 deleted the add/37985 branch May 8, 2023 14:05
@github-actions github-actions bot added this to the 7.8.0 milestone May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Product Block Editor: Add Sale price validation

3 participants