diff --git a/plugins/woocommerce/changelog/add-docblocks-to-products-shortcode-hooks b/plugins/woocommerce/changelog/add-docblocks-to-products-shortcode-hooks new file mode 100644 index 00000000000..0c79db17c86 --- /dev/null +++ b/plugins/woocommerce/changelog/add-docblocks-to-products-shortcode-hooks @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Added doc blocks to conditionally fired hooks to better explain nuanced behavior diff --git a/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php b/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php index 9b551b3f2e0..51eed9c2753 100644 --- a/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php +++ b/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php @@ -641,8 +641,13 @@ class WC_Shortcode_Products { do_action( "woocommerce_shortcode_before_{$this->type}_loop", $this->attributes ); - // Fire standard shop loop hooks when paginating results so we can show result counts and so on. if ( wc_string_to_bool( $this->attributes['paginate'] ) ) { + /** + * Fire the standard shop hooks when paginating so we can display result counts etc. + * If the pagination is not enabled, this hook will not be fired. + * + * @since 3.3.1 + */ do_action( 'woocommerce_before_shop_loop' ); } @@ -667,8 +672,13 @@ class WC_Shortcode_Products { $GLOBALS['post'] = $original_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited woocommerce_product_loop_end(); - // Fire standard shop loop hooks when paginating results so we can show result counts and so on. if ( wc_string_to_bool( $this->attributes['paginate'] ) ) { + /** + * Fire the standard shop hooks when paginating so we can display the pagination. + * If the pagination is not enabled, this hook will not be fired. + * + * @since 3.3.1 + */ do_action( 'woocommerce_after_shop_loop' ); }