WC_Shortcodes::product_category( array $atts )
List products in a category shortcode.
Description Description
Parameters Parameters
- $atts
-
(Required) Attributes.
Return Return
(string)
Source Source
File: includes/class-wc-shortcodes.php
public static function product_category( $atts ) {
if ( empty( $atts['category'] ) ) {
return '';
}
$atts = array_merge(
array(
'limit' => '12',
'columns' => '4',
'orderby' => 'menu_order title',
'order' => 'ASC',
'category' => '',
'cat_operator' => 'IN',
),
(array) $atts
);
$shortcode = new WC_Shortcode_Products( $atts, 'product_category' );
return $shortcode->get_content();
}