WC_Shortcodes::product_attribute( array $atts )
List products with an attribute shortcode.
Description Description
Example [product_attribute attribute="color" filter="black"].
Parameters Parameters
- $atts
-
(Required) Attributes.
Return Return
(string)
Source Source
File: includes/class-wc-shortcodes.php
public static function product_attribute( $atts ) {
$atts = array_merge(
array(
'limit' => '12',
'columns' => '4',
'orderby' => 'title',
'order' => 'ASC',
'attribute' => '',
'terms' => '',
),
(array) $atts
);
if ( empty( $atts['attribute'] ) ) {
return '';
}
$shortcode = new WC_Shortcode_Products( $atts, 'product_attribute' );
return $shortcode->get_content();
}