Product Icon

WooCommerce

Sell online with the flexible, customizable eCommerce platform designed to grow with your business. From your first sale to millions in revenue, Woo is with you. See why merchants trust us to power 3.4 million online stores.

Cross sell output on product page (filter/settings)

Currently, Cross sell selected in the admin for products only affects the output of offered products on the cart page for cross-selling. This is a standard feature of WooCommerce.

Add settings in the plugin to enable Cross sell output on the product page. And create a filter to display such products.

This will allow us to manage product offers more easily and flexibly, avoiding excessive custom code

Currently, the possibilities of use are limited. Although you can use a similar solution:
add_action( ‘woocommerce_after_single_product’, ‘my_crossels’, 20 ); function my_crossels( $limit = 2, $columns = 2, $orderby = ‘rand’, $order = ‘desc’) { global $product; $cross_sells = array_filter( array_map( ‘wc_get_product’, $product->get_cross_sell_ids() ), ‘wc_products_array_filter_visible’ ); wc_set_loop_prop( ‘name’, ‘cross-sells’ ); wc_set_loop_prop( ‘columns’, apply_filters( ‘woocommerce_cross_sells_columns’, $columns ) ); // Handle orderby and limit results. $orderby = apply_filters( ‘woocommerce_cross_sells_orderby’, $orderby ); $order = apply_filters( ‘woocommerce_cross_sells_order’, $order ); $cross_sells = wc_products_array_orderby( $cross_sells, $orderby, $order ); $limit = apply_filters( ‘woocommerce_cross_sells_total’, $limit ); $cross_sells = $limit > 0 ? array_slice( $cross_sells, 0, $limit ) : $cross_sells; wc_get_template( ‘cart/cross-sells.php’, array( ‘cross_sells’ => $cross_sells, // Not used now, but used in previous version of up-sells.php. ‘posts_per_page’ => $limit, ‘orderby’ => $orderby, ‘columns’ => $columns, ) ); }

Author

tunyk

Current Status

Open

Last updated: April 24, 2025

0 comments

Log in to comment on this feature request.