WordPress at Your Fingertips
function is not described

WC_Shortcodes::related_products() public WC 1.0

List related products.

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

No Hooks.

Return

String.

Usage

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

Code of WC_Shortcodes::related_products() WC 5.9.0

public static function related_products( $atts ) {
	if ( isset( $atts['per_page'] ) ) {
		$atts['limit'] = $atts['per_page'];
	}

	// @codingStandardsIgnoreStart
	$atts = shortcode_atts( array(
		'limit'    => '4',
		'columns'  => '4',
		'orderby'  => 'rand',
	), $atts, 'related_products' );
	// @codingStandardsIgnoreEnd

	ob_start();

	// Rename arg.
	$atts['posts_per_page'] = absint( $atts['limit'] );

	woocommerce_related_products( $atts );

	return ob_get_clean();
}