Skip to content
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

Track stock quantity for this product should be disabled when Enable stock management within settings is disabled, and enabled otherwise #37957

Merged
merged 2 commits into from Apr 24, 2023

Conversation

mdperez86
Copy link
Contributor

@mdperez86 mdperez86 commented Apr 24, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #37888

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. If Manage stock is active under /wp-admin/admin.php?page=wc-settings&tab=products&section=inventory then Track stock quantity for this product under /wp-admin/admin.php?page=wc-admin&path=/add-product&tab=inventory should be enabled
  4. If Manage stock is not active under /wp-admin/admin.php?page=wc-settings&tab=products&section=inventory then Track stock quantity for this product under /wp-admin/admin.php?page=wc-admin&path=/add-product&tab=inventory should be disabled

…stock management within settings is disabled, and enabled otherwise.
@mdperez86 mdperez86 requested a review from a team April 24, 2023 17:00
@mdperez86 mdperez86 self-assigned this Apr 24, 2023
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 24, 2023
@github-actions
Copy link
Contributor

Hi , @woocommerce/mothra

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

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.

Nice addition with the disabled prop for the toggle block! Testing well and LGTM!

Left one comment just thinking out loud about how we use this in the future, butI think we can address this when we get there.

@@ -14,6 +14,10 @@
},
"property": {
"type": "string"
},
"disabled": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good call!

@@ -625,6 +625,7 @@ public static function register_post_types() {
array(
'label' => __( 'Track stock quantity for this product', 'woocommerce' ),
'property' => 'manage_stock',
'disabled' => 'yes' !== get_option( 'woocommerce_manage_stock' ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Just thinking about this in the future: once the settings screens are Reactified, we might want the ability to either:
a. Refetch this template (so we have the correct disabled property) OR
b. Move this setting check to the frontend

But this issue doesn't exist for the time being and I think punting it down the road is fine.

@github-actions
Copy link
Contributor

Test Results Summary

Commit SHA: a776c64

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests26700202690m 55s
E2E Tests1870010019719m 1s

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.

@mdperez86 mdperez86 merged commit fb7e68a into trunk Apr 24, 2023
18 of 19 checks passed
@mdperez86 mdperez86 deleted the add/37888 branch April 24, 2023 17:42
@github-actions github-actions bot added this to the 7.8.0 milestone Apr 24, 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: Track stock toggle not disabled when stock management is disabled
2 participants