-
-
Hello –
I would like 4 columns (4 products) to display as cross-sells in my WooCommerce cart. Up until this most recent update, the fix was to go to includes/wc-template-functions.php and change
$defaults = array(
‘posts_per_page’ => 2,
‘columns’ => 2,TO
$defaults = array(
‘posts_per_page’ => 2,
‘columns’ => 4,However – that code no longer exists in the newest update (3.3.3) and I can’t find anything else that is similar in that file. Is there another place I need to look, or perhaps CSS code I need to add to the template to achieve this result? I see from searching the forum that this is a common request (changing the default 2 columns to 4 columns for product display) so hopefully it’s an easy fix, as before.
Please note: the products are displaying as 4 columns everywhere else on the site – it is only within the cart, as cross-sells, that they are defaulting to 2 products.
Thanks!
Rebecca
-
Hello,
Please go to the same file and look for this block of code:
/** * Output the cart cross-sells. * * @param int $limit (default: 2). * @param int $columns (default: 2). * @param string $orderby (default: 'rand'). * @param string $order (default: 'desc'). */
Change here the values of limit and columna from 2, to 4. Save changes and refresh page.
Let us know how it goes.Best regards!
-
Hey there – I made the changes, but it did not work. I found the code directly beneath that:
function woocommerce_cross_sell_display( $limit = 2, $columns = 2, $orderby = ‘rand’, $order = ‘desc’ )
and changed it to:
function woocommerce_cross_sell_display( $limit = 4, $columns = 4, $orderby = ‘rand’, $order = ‘desc’ )
That worked! I just wanted to put it on the thread, in case someone else is searching with this same issue.
Rebecca -
-
You must be logged in to reply to this topic.