WC_Shortcodes::product()public staticWC 1.0

Display a single product.

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

Хуков нет.

Возвращает

Строку.

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

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

Код WC_Shortcodes::product() WC 8.7.0

public static function product( $atts ) {
	if ( empty( $atts ) ) {
		return '';
	}

	$atts['skus']  = isset( $atts['sku'] ) ? $atts['sku'] : '';
	$atts['ids']   = isset( $atts['id'] ) ? $atts['id'] : '';
	$atts['limit'] = '1';
	$shortcode     = new WC_Shortcode_Products( (array) $atts, 'product' );

	return $shortcode->get_content();
}