Site logo

[Resolved] Change number of Cross Sells columns on WooCommerce cart page

Home Forums Support [Resolved] Change number of Cross Sells columns on WooCommerce cart page

Home Forums Support Change number of Cross Sells columns on WooCommerce cart page

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2443853
    Debra

    My WooCommerce cart is set to show 2 columns for Cross Sells. I’m not sure if this is something I set somewhere or not (I cannot find a setting option). I want to change this to 1 column. Any suggestions?

    #2443878
    Fernando
    Customer Support

    Hi Debra,

    Can you go to Appearance > GeneratePress, and enable the WooCommerce module if it’s disabled?

    Then, go to Appearance > Customize > Layout > WooCommerce > Single Product, and change the Related/Upsell Columns value to your preference – 1.

    Reference: https://docs.generatepress.com/article/woocommerce-overview/#single-product

    #2443885
    Debra

    Hi Fernando,

    Thanks for the response. Changing that setting to 1 still formats the cross-sells in the cart with 2 columns. However, it does change the columns on my Single Product display.

    If possible, I would like to keep the number of columns on my Single Product pages set to something different than on the cart page.

    When I inspect the CSS on the cart page I see: <div class="cross-sells"><ul class="products columns-2">. (This is the same regardless of what number I set in the Appearance > Customize > Layout > WooCommerce > Single Product > Related/Upsell Columns value.)

    #2443891
    Fernando
    Customer Support

    I see. Sorry, I misunderstood. The column setting for that section is controlled by WooCommerce.

    To alter it, you can try adding this PHP snippet:

    add_filter( 'woocommerce_cross_sells_columns', 'change_cross_sells_columns' );
     
    function change_cross_sells_columns( $columns ) {
        return 1;
    }

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    This should turn columns-2 to columns-1.

    Let us know how it goes.

    #2443898
    Debra

    That changes the CSS to show <div class="cross-sells"><ul class="products columns-1"> However, I was hoping my product would resize to fill that column. Instead, it still displays as if it’s in a 2 column format.

    #2443919
    Fernando
    Customer Support

    I see. Try adding this through Appearance > Customize > Additional CSS:

    .cross-sells ul.products.columns-1 > li {
        width: 100% !important;
        text-align: center;
    }
    
    .cross-sells ul.products.columns-1 > li .inside-wc-product-image {
        width: 100%
    }
    .cross-sells ul.products.columns-1 > li .star-rating {
        margin-left: auto;
        margin-right: auto;
    }
    #2444887
    Debra

    That works perfectly! Is there a tip jar here for outstanding support?

    #2444901
    David
    Staff
    Customer Support

    Hi there,

    we do have a tip jar 🙂 It can be found here:

    https://generatepress.com/ongoing-development/

    #2444942
    Debra

    Perfect! Thanks, David!

    #2446310
    David
    Staff
    Customer Support

    Thank you ! It is much appreciated 🙂

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.