WC_Shortcodes::products( array $atts )
List multiple products shortcode.
Description Description
Parameters Parameters
- $atts
-
(Required) Attributes.
Return Return
(string)
Source Source
File: includes/class-wc-shortcodes.php
public static function products( $atts ) {
$atts = (array) $atts;
$type = 'products';
// Allow list product based on specific cases.
if ( isset( $atts['on_sale'] ) && wc_string_to_bool( $atts['on_sale'] ) ) {
$type = 'sale_products';
} elseif ( isset( $atts['best_selling'] ) && wc_string_to_bool( $atts['best_selling'] ) ) {
$type = 'best_selling_products';
} elseif ( isset( $atts['top_rated'] ) && wc_string_to_bool( $atts['top_rated'] ) ) {
$type = 'top_rated_products';
}
$shortcode = new WC_Shortcode_Products( $atts, $type );
return $shortcode->get_content();
}