AI Verified

Name

Change number of related products on product page

About

The so called "Related Products" are a great thing, however you might want to influence the output of these similar items a bit. This code takes care of that.

Language

PHP

Rating

Voted: 0 by 0 user(s)

How to Setup Snippet

Set your own value for 'posts_per_page'

Codevault

jbeer

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: Not Specified

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

14/11/2022

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Change number of related products on product page

 
                    
1if (!function_exists('evolution_related_products_args') ) {
2/**
3 * WooCommerce Extra Feature
4 * --------------------------
5 *
6 * Change number of related products on product page
7 * Set your own value for 'posts_per_page'
8 *
9 */
10function evolution_related_products_args( $args ) {
11 
12 $args['posts_per_page'] = 4; // 4 aehnliche Produkte
13 $args['columns'] = 4; // in 4 Spalten angezeigt
14 return $args;
15 
16 }
17}
18add_filter( 'woocommerce_output_related_products_args', 'evolution_related_products_args' );

0

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

0

WooCommerce Show Product SKUs In Emails

Added: 1 year ago

Last Updated: 1 year ago

This snippet appends the product SKU adjacent to the product names in all emails.

WooCommerce

AI Verified

1

Add WooCommerce Product Type as Admin Column

Added: 3 months ago

Last Updated: 1 month ago

Make it easier to spot if a Product is a Simple or Variable Product.

WooCommerce

AI Verified

0

Display Prices With + Without Tax

Added: 1 year ago

Last Updated: 1 year ago

This code snippet is a part of a WordPress plugin or theme customization that modifies the display of prices in the WooCommerce plugin, specifically the suffix that appears after the product price....

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WooCommerce

AI Verified

2

Confirm Password Field in Woocommerce

Added: 1 year ago

Last Updated: 1 year ago

WooCommerce

AI Verified

2

Bypass logout confirmation.

Added: 1 year ago

Last Updated: 1 month ago

WooCommerce

AI Verified

2

Add Product Picture to Orderlist

Added: 1 year ago

Last Updated: 1 year ago