Add doc blocks to Products shortcode hooks (#51061)
* Add doc blocks to products shortcode woocommerce_before_shop_loop hooks * Improved comments * Add changelog
This commit is contained in:
parent
5999ea6716
commit
44b5f54d08
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Added doc blocks to conditionally fired hooks to better explain nuanced behavior
|
|
@ -641,8 +641,13 @@ class WC_Shortcode_Products {
|
||||||
|
|
||||||
do_action( "woocommerce_shortcode_before_{$this->type}_loop", $this->attributes );
|
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'] ) ) {
|
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' );
|
do_action( 'woocommerce_before_shop_loop' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,8 +672,13 @@ class WC_Shortcode_Products {
|
||||||
$GLOBALS['post'] = $original_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
$GLOBALS['post'] = $original_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||||
woocommerce_product_loop_end();
|
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'] ) ) {
|
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' );
|
do_action( 'woocommerce_after_shop_loop' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue