Skip to content

Conversation

@stevegrunwell
Copy link
Contributor

@stevegrunwell stevegrunwell commented Jan 12, 2021

All Submissions:

Changes proposed in this Pull Request:

This PR re-works the WC_Shipping_Zone_Data_Store::read() method in the following ways:

  1. Remove a confusing conditional (if ( 0 !== $zone->get_id() || '0' !== $zone->get_id() ) { ... })
  2. Return early if we're dealing with Zone 0, eliminating additional conditional steps
  3. Add documentation for the "woocommerce_shipping_zone_loaded" action hook

How to test the changes in this Pull Request:

  1. Create a new shipping zone within WooCommerce (if one does not exist)
  2. Attempt to read the shipping zone from the database (WP Admin is a good place to do so)

The shipping zone should load as it did before.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Dev- Clean up the WC_Shipping_Zone_Data_Store::read() method, documenting the woocommerce_shipping_zone_loaded hook.

This commit re-works the `WC_Shipping_Zone_Data_Store::read()` method in the following ways:

1. Remove a confusing conditional (`if ( 0 !== $zone->get_id() || '0' !== $zone->get_id() ) { ... }`)
2. Return early if we're dealing with Zone 0, eliminating additional conditional steps
3. Add documentation for the "woocommerce_shipping_zone_loaded" action hook
…efactoring of WC_Shipping_Zone_Data_Store_CPT::read()
Copy link
Contributor

@claudiosanches claudiosanches left a comment

Choose a reason for hiding this comment

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

Thank you very much!
Code looks great!

@claudiosanches claudiosanches merged commit e698ed7 into woocommerce:master Jan 15, 2021
@woocommercebot woocommercebot added release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Jan 15, 2021
@claudiosanches claudiosanches removed the release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] label Jan 15, 2021
@claudiosanches claudiosanches added this to the 5.0.0 milestone Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: add changelog Mark all PRs that have not had their changelog entries added. [auto]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants