WordPress at Your Fingertips
function is not described

WC_Shortcodes::product_attribute() public WC 1.0

List products with an attribute shortcode. Example [product_attribute attribute="color" filter="black"].

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

No Hooks.

Return

String.

Usage

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

Code of WC_Shortcodes::product_attribute() WC 5.9.0

public static function product_attribute( $atts ) {
	$atts = array_merge(
		array(
			'limit'     => '12',
			'columns'   => '4',
			'orderby'   => 'title',
			'order'     => 'ASC',
			'attribute' => '',
			'terms'     => '',
		),
		(array) $atts
	);

	if ( empty( $atts['attribute'] ) ) {
		return '';
	}

	$shortcode = new WC_Shortcode_Products( $atts, 'product_attribute' );

	return $shortcode->get_content();
}