Do you want to change the number of related products per row? Related Products is a section on some templates that pulls products from your store that share the same tags or categories as the current product.
It is important to note that the products cannot be specified in the admin. However, it can be influenced by grouping similar products in the same category or by using the same tags.
You may want to increase the number of products on the related products section to develop the browsing or buying choice of the user.
Changing the number of related products to display is very easy. However, you need to have some coding skills to implement this solution.
You can use a plugin, but we recommend using custom code to make minor changes. This is because they add unnecessary bloat to your site.
WooCommerce Change Number of Related Products Per Row
In this post, we will share how you can change the number of related products per row in WooCommerce.
However, you should create a child theme, so that your changes are not lost when an update occurs.
Let us look at how you can achieve this.
Steps to Change Number of Related Products Per Row
This is how the related product section is displayed:
Here are the steps you need to follow:
- Log into your WordPress site and access the Dashboard as the admin user.
- From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file where we will add the function that will change the number of related products per row.
- Add the following code to the php file:
function njengah_change_related_products() {
global $product;
$args[‘posts_per_page’] = 6;
return $args;
}
add_filter( ‘woocommerce_output_related_products_args’, ‘njengah_related_products_args’ );
function njengah_related_products_args( $args ) {
$args[‘posts_per_page’] = 4; // 4 related products
$args[‘columns’] = 2; // arranged in 2 columns
return $args;
}
[/php]
Conclusion
By now, you should be able to change the number of related products in your WooCommerce store.
You should be careful when editing the functions.php file because if you make any mistake, a critical error will occur.
If you need further customization or if you have any problem implementing the code, please consider hiring a WooCommerce developer.
Similar Articles
- WooCommerce Redirect After Logout [Ultimate Guide]
- WooCommerce Redirect After Checkout : Redirect to Custom Thank You Page
- How to Add Checkout Phone Number Validation WooCommerce
- How to Add WooCommerce Storefront Product Pagination
- How to Add Currency to WooCommerce [Custom Currency]
- WooCommerce Storefront CSS Complete Customization Guide
- How to Remove Related Products WooCommerce Storefront Theme
- How to Change Email Sender In WooCommerce
- How to Change Checkout Endpoints WooCommerce
- How to Set Custom Related Products In WooCommerce
- How to Remove Related Products in WooCommerce in 3 Easy Options
- How to Check if User is Logged In WordPress
- How to Change Currency Symbol In WooCommerce
- How to Create Checkbox Field in WooCommerce Checkout Page
- How to Hide WooCommerce Marketing Hub Admin Option
- How to Customize WooCommerce Product Pages
- How to Count Items Added to Cart WooCommerce Cart Count Code
- How to Make WooCommerce Storefront Header Transparent
- How to Get Order ID In WooCommerce
- WooCommerce Mobile Checkout Optimization Quick Guide
Comments are closed.