Home Forums Free Themes Clean Commerce Reducing related products from 4 to 3

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #41657
    roomAromas
    Participant

    Hi,

    I would like to remove the related products showing under product description from 4 to 3.

    I followed the link to woocommerce that shows how to change this in functions.php but the code is not in that file.

    I also tried to add custom CSS

    .related.products {
    display: 3;
    }

    but this did not work either

    How to I change this?

    Also, how do I change the size of the category icons and the product icons to make them all the same size and reduce size slightly?

    thanks
    Lee

    #41658
    wensolutions
    Keymaster

    Hello @roomaromas,

    To display only three product in related product section you have to create and activate the child theme.

    Child theme references:
    https://codex.wordpress.org/Child_Themes

    You can also create the child theme using plugin:
    https://wordpress.org/plugins/wp-child-theme-generator/

    After activating the child theme in your child themes functions.php include below given code:

    add_filter( 'woocommerce_output_related_products_args', 'clean_commerce_child_related_products_args' );
      /**
       * [clean_commerce_child_related_products_args Woo related Products Fix]
       * @param  [type] $args [array]
       * @return [type]       [array]
       */
      function clean_commerce_child_related_products_args( $args ) {
    	$args['posts_per_page'] = 3; // 3 related products
    	return $args;
    }

    We are not very clear on your second query i.e. “size of the category icons and the product icons” so please send the proper screen shot of the issue so we could provide precise fix .

    Hope this helps.

    Best Regards!!

    #41659
    roomAromas
    Participant

    Thanks.

    I will look at the child themes.

    The site. http://leew5.sg-host.com/product-category/room-aromas/large-aromas-25-30ml/

    Some products int he category show a different size. I want all images to show the same size.

    thanks
    lee

    #41661
    wensolutions
    Keymaster

    Hello @roomaromas,

    Please try Regenerating thumbnails using the plugin like given below:

    https://wordpress.org/plugins/regenerate-thumbnails/

    If this does not solve the issue, please kindly let us know.

    Best Regards!!

    #41662
    roomAromas
    Participant

    Thanks. Will try that.

    🙂

    PS, the solution above worked but pain because all previous settings I now have to make again to the child theme.

    #41706
    wensolutions
    Keymaster

    Hello @roomaromas,

    Nice to know that your issue is solved .

    If your are having difficulty in re setting the customizer after activating the child theme then please include the below given code in your child themes functions.php .

    function clean_commerce_child_customizer_options_import() {
    
    if ( get_stylesheet() !== get_template() ) {
       add_filter( 'pre_update_option_theme_mods_' . get_stylesheet(), function ( $value, $old_value ) {
            update_option( 'theme_mods_' . get_template(), $value );
            return $old_value; // prevent update to child theme mods
       }, 10, 2 );
       add_filter( 'pre_option_theme_mods_' . get_stylesheet(), function ( $default ) {
           return get_option( 'theme_mods_' . get_template(), $default );
       } );
    }
    }
    
    add_action('init', 'clean_commerce_child_customizer_options_import');

    This code will allow all the setting of parent theme to be in the child theme so you don’t have to re enter the settings .

    Hope this helps.

    Best Regards!!

    #41729
    roomAromas
    Participant

    Thanks. I have updated the file so any future changes will not change the child theme.

    thanks
    Lee

    #41738
    wensolutions
    Keymaster

    Hello @roomaromas,

    We are very glad that we could help you with your issues .

    If you have any query further we are always here for you.

    Best Regards!!

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