category support for sale_products shortcode

This commit is contained in:
Mike Jolley 2016-04-20 12:27:20 +01:00
parent 9eb32a2bd8
commit f3762d9ed5
1 changed files with 5 additions and 1 deletions

View File

@ -527,7 +527,9 @@ class WC_Shortcodes {
'per_page' => '12',
'columns' => '4',
'orderby' => 'title',
'order' => 'asc'
'order' => 'asc',
'category' => '', // Slugs
'operator' => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'.
), $atts );
$query_args = array(
@ -541,6 +543,8 @@ class WC_Shortcodes {
'post__in' => array_merge( array( 0 ), wc_get_product_ids_on_sale() )
);
$query_args = self::_maybe_add_category_args( $query_args, $atts['category'], $atts['operator'] );
return self::product_loop( $query_args, $atts, 'sale_products' );
}