WordPress at Your Fingertips
function is not described

WC_Shortcodes::products() public WC 1.0

List multiple products shortcode.

{} It's a method of the class: WC_Shortcodes{}

No Hooks.

Return

String.

Usage

$result = WC_Shortcodes::products( $atts );
$atts(array) (required)
Attributes.

Code of WC_Shortcodes::products() WC 5.9.0

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();
}