WC_Shortcodes::product()public staticWC 1.0

Display a single product.

Method of the class: WC_Shortcodes{}

No Hooks.

Return

String.

Usage

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

WC_Shortcodes::product() code 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();
}