New Landing How can we help? Themeforest Theme Support Dante Change number of Related Products

Viewing 15 posts - 1 through 15 (of 19 total)
  • Posted in: Dante
  • #200407
    saury316
    Member
    Post count: 31

    This is a two-part question.
    1) Is there a way to restrict the number of related products that are visible on a page? E.g. I have used very broad categories to define my products so there are 8-10 related products for each item. I just want 4 to be visible on the page.

    2) Can I make the images and text for related products smaller? At the moment they’re very big.

    Thanks in advance!

    #200408
    saury316
    Member
    Post count: 31

    Oh I tried to use the code here but it really messed things up.

    #200430
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please provide me specific page url with related products.
    Thanks
    Mohammad

    #200438
    saury316
    Member
    Post count: 31

    Here is an example – http://www.nottheusual.nu/watch/nu-triangle-shaped-diamante-bling-lincoln-centre-mid-size-bracelet-watch-purple/

    As you can see there are currently 5 related products. I would like to restrict this number to 4.

    Thanks

    #200468
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I see only one related product here.
    Thanks
    Mohammad

    #200480
    saury316
    Member
    Post count: 31

    Hi Mohammed,

    You’re looking at the “You may also like…” section which contains the up-sells part. If you scroll further down, there are now 9 products in “Related products” when I would like to restrict this to just 4.

    Thanks.

    #200484
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You are right. I see only one You may also like. There is no any related product at this page http://www.nottheusual.nu/watch/nu-triangle-shaped-diamante-bling-lincoln-centre-mid-size-bracelet-watch-purple/.
    Thanks
    Mohammad

    #200489
    saury316
    Member
    Post count: 31

    Also on mobile, the Dante demo has a really nice implementation of the related products which doesn’t quite work on mine.

    e.g. this vs mine

    Attachments:
    You must be logged in to view attached files.
    #200496
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme.

    add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' );
      function jk_related_products_args( $args ) {
    	$args['posts_per_page'] = 4; // 4 related products
    	$args['columns'] = 4; // arranged in 2 columns
    	return $args;
    }

    Thanks
    Mohammad

    #200533
    saury316
    Member
    Post count: 31

    Hi Mohammed,

    I tried that before and it doesn’t work, there are still ~9 products visible.
    Also I’m still not getting that nice clean look on mobile.

    Thanks.

    #200558
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    On Which page url are you watching 9 products? I checked many product but dont seen any related project. Please provide me product page url with 9 related products.
    Thanks
    Mohammad

    #200561
    saury316
    Member
    Post count: 31

    Hi Mohammad,

    It is the same product link as before. I’ve purged my caches and reloaded the page – see attached screenshot.

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #200569
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I have resolved the issue so please check.
    Thanks
    Mohammad

    #200821
    saury316
    Member
    Post count: 31

    Awesome, Mohammad! Thanks so much for your help 🙂

    #200828
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You most welcome.
    Thanks
    Mohammad

Viewing 15 posts - 1 through 15 (of 19 total)

You must be logged in to reply to this topic.