• Resolved kristinubute

    (@kristinubute)


    Hi

    I need to show 4 columns/products in RELATED PRODUCTS on the single products page on my client site.

    Currently it is showing 3 products only (seems to be woocommerce default).

    Rest of site is 4 columns.

    I think there is a function code that I can add or something to allow to show 4 columns in the RELATED PRODUCTS area?

    I’ve been googling as I can’t remember how to fix it.

    Any advice would be greatly appreciated.

    Thanks in advance

    Regards Kristin

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter kristinubute

    (@kristinubute)

    But as things will vary from different devices, Ipad needs to still show 3 related products otherwise 4 would leave 1 by itself which doesn’t look good.

    PC to show 4 and 13″ and 14″ laptops to show 4 columns

    Thread Starter kristinubute

    (@kristinubute)

    I have figured it out. I found a functions code that I can use to change this to 4 columns for RELATED PRODUCTS.

    Hey, @kristinubute!

    I’m glad you were able to figure out how to do this.

    If you feel comfortable doing so, would you mind sharing it here? Sharing the solutions on the forum really helps the WooCommerce community as another user might be searching for it in the future.

    Thank you!

    Please let us know if there’s anything else we can do to help or if you have any questions.

    Have a wonderful day!

    Thread Starter kristinubute

    (@kristinubute)

    Yes I can share. I still have an issue on the Ipad & mobile where it doesn’t show properly on the Ipad in 2 columns for the RELATED PRODUCTS (it shows 1 product on left side in 1st column and then it shows another product on 2nd line right side) so I think it is pushing it down as it is not fitting. If someone could possibly help with that would be great. ALSO on the Ipad it normally shows 3 but as I added a code to allow 4 colums products to show in the RELATED PRODUCTS (on Ipad it shows 3 products and the 4th product on its own on the 2nd line which doesn’t look good).

    So I am a bit stuck still.

    Can I just somehow code that the Ipad ONLY shows 3 RELATED PRODUCTS and that the mobile just shows 2 RELATED PRODUCTS. Is that possible to show differently on different devices.

    Here is my code I used.

    /**

    • Change number of related products output
      */
      function woo_related_products_limit() {
      global $product; $args[‘posts_per_page’] = 6;
      return $args;
      }
      add_filter( ‘woocommerce_output_related_products_args’, ‘jk_related_products_args’, 20 );
      function jk_related_products_args( $args ) {
      $args[‘posts_per_page’] = 4; // 4 related products
      $args[‘columns’] = 2; // arranged in 2 columns
      return $args;
      }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to show 4 columns/products in RELATED PRODUCTS’ is closed to new replies.