Ignore catalog visibility on products shortcode when specifying ids and skus

This commit is contained in:
Mike Jolley 2016-03-14 10:49:11 +00:00
parent 733b0c8c93
commit 571956d57d
1 changed files with 6 additions and 0 deletions

View File

@ -345,10 +345,16 @@ class WC_Shortcodes {
'value' => array_map( 'trim', explode( ',', $atts['skus'] ) ),
'compare' => 'IN'
);
// Ignore catalog visibility
$query_args['meta_query'] = WC()->query->stock_status_meta_query();
}
if ( ! empty( $atts['ids'] ) ) {
$query_args['post__in'] = array_map( 'trim', explode( ',', $atts['ids'] ) );
// Ignore catalog visibility
$query_args['meta_query'] = WC()->query->stock_status_meta_query();
}
return self::product_loop( $query_args, $atts, 'products' );