Apply query_arg filter before generating transient name in product_loop
Fixes #14259
This commit is contained in:
parent
b3fe358168
commit
cb668d42e0
|
@ -87,11 +87,12 @@ class WC_Shortcodes {
|
|||
$columns = absint( $atts['columns'] );
|
||||
$woocommerce_loop['columns'] = $columns;
|
||||
$woocommerce_loop['name'] = $loop_name;
|
||||
$query_args = apply_filters( 'woocommerce_shortcode_products_query', $query_args, $atts, $loop_name );
|
||||
$transient_name = 'wc_loop' . substr( md5( json_encode( $query_args ) . $loop_name ), 28 ) . WC_Cache_Helper::get_transient_version( 'product_query' );
|
||||
$products = get_transient( $transient_name );
|
||||
|
||||
if ( false === $products || ! is_a( $products, 'WP_Query' ) ) {
|
||||
$products = new WP_Query( apply_filters( 'woocommerce_shortcode_products_query', $query_args, $atts, $loop_name ) );
|
||||
$products = new WP_Query( $query_args );
|
||||
set_transient( $transient_name, $products, DAY_IN_SECONDS * 30 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue