Updates Block validation to return an object containing the error message and the clientId as context to support the new link displayed in the snackbar.
Additionally, with WooCommerce 9.2.0-rc.1 the Multipack field validation changes so if a decimal value was entered a blank error message was displayed:
As it's not possible to either set a default validation error message or add custom rules outside of the supported few, the field has been updated to use a text field instead of number. A pattern is then supplied with a custom error message to prevent users from entering non numeric values, decimal values, or negative values.
Detailed test instructions:
npm run wp-env:up
npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version=9.2.0-rc.1
npm run -- wp-env run tests-cli -- wp wc update
npm run test:e2e
Confirm tests pass
Enable the new product editor in WooCommerce > Settings > Advanced > Features
Edit a product and test different values in the Multipack field under the Google for WooCommerce tab
Confirm only whole numbers are accepted input
Additional
⚠️ Please merge once approved as this PR is required before GLA can be released with the 9.2.0 compat bump.
Changelog entry
Update - Block validation to support error context
Changes proposed in this Pull Request:
Closes #2507
Updates Block validation to return an object containing the error message and the clientId as context to support the new link displayed in the snackbar.
Additionally, with WooCommerce
9.2.0-rc.1
theMultipack
field validation changes so if a decimal value was entered a blank error message was displayed:As it's not possible to either set a default validation error message or add custom rules outside of the supported few, the field has been updated to use a text field instead of number. A pattern is then supplied with a custom error message to prevent users from entering non numeric values, decimal values, or negative values.
Detailed test instructions:
npm run wp-env:up
npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version=9.2.0-rc.1
npm run -- wp-env run tests-cli -- wp wc update
npm run test:e2e
WooCommerce > Settings > Advanced > Features
Multipack
field under theGoogle for WooCommerce
tabAdditional
⚠️ Please merge once approved as this PR is required before GLA can be released with the
9.2.0
compat bump.Changelog entry