WC_Shortcodes::products()public staticWC 1.0

List multiple products shortcode.

Метод класса: WC_Shortcodes{}

Хуков нет.

Возвращает

Строку.

Использование

$result = WC_Shortcodes::products( $atts );
$atts(массив) (обязательный)
Attributes.

Код WC_Shortcodes::products() WC 8.7.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();
}