WC_Shortcodes::product_category( array $atts )

List products in a category shortcode.


Description Description


Parameters Parameters

$atts

(Required) Attributes.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-wc-shortcodes.php

	public static function product_category( $atts ) {
		if ( empty( $atts['category'] ) ) {
			return '';
		}

		$atts = array_merge(
			array(
				'limit'        => '12',
				'columns'      => '4',
				'orderby'      => 'menu_order title',
				'order'        => 'ASC',
				'category'     => '',
				'cat_operator' => 'IN',
			),
			(array) $atts
		);

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

		return $shortcode->get_content();
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.