Home › Forums › Free Themes › Clean Commerce › Reducing related products from 4 to 3
- This topic has 7 replies, 2 voices, and was last updated 7 years, 5 months ago by wensolutions.
-
AuthorPosts
-
May 4, 2017 at 7:08 am #41657roomAromasParticipant
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
LeeMay 4, 2017 at 7:40 am #41658wensolutionsKeymasterHello @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_ThemesYou 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!!
May 4, 2017 at 7:44 am #41659roomAromasParticipantThanks.
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
leeMay 4, 2017 at 7:54 am #41661wensolutionsKeymasterHello @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!!
May 4, 2017 at 7:59 am #41662roomAromasParticipantThanks. Will try that.
🙂
PS, the solution above worked but pain because all previous settings I now have to make again to the child theme.
May 5, 2017 at 12:04 am #41706wensolutionsKeymasterHello @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!!
May 5, 2017 at 4:21 am #41729roomAromasParticipantThanks. I have updated the file so any future changes will not change the child theme.
thanks
LeeMay 5, 2017 at 4:43 am #41738wensolutionsKeymasterHello @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!!
-
AuthorPosts
- You must be logged in to reply to this topic.