Upsells are the ones shown on product pages, you’re aware?
function my_cross_sell( $args ) {
$args['posts_per_page'] = 3;
$args['columns'] = 3;
return $args;
}
add_filter( 'woocommerce_upsell_display_args', 'my_cross_sell' );
Thanks for you reply,
yes I am aware, I want the owner to be able to select his own product to show underneath a product in content-single-product
Should I do this with the upsells
or crosssells
?
either way, I tried your code and still get outputted four items (I have selected four items in the backend for the single product to check this.
related products wont work as they are chosen by category etc
cross sells are shown on product pages, up sells are shown on cart.
yeah, thats what I though, however add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
shows cross sells on the cart page? or do they use the same template?
I still don’t know how to set the posts per page to 3
instead of the standard -1
(unlimited) though for either cross sells or upsells
the code from you first answer did not work
Derp I got it back to front :p For the CROSS sells, (cart page my bad), you can control columns and limit with:
woocommerce_cross_sells_columns
woocommerce_cross_sells_total
https://github.com/woothemes/woocommerce/blob/master/templates/cart/cross-sells.php#L33