WC_Shortcodes::related_products()
List related products.
Method of the class: WC_Shortcodes{}
No Hooks.
Return
String
.
Usage
$result = WC_Shortcodes::related_products( $atts );
- $atts(array) (required)
- Attributes.
WC_Shortcodes::related_products() WC Shortcodes::related products code WC 7.5.1
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(); }