Last active
November 26, 2021 23:25
-
-
Save woogists/f6f2ec75fce3b56cc80b446c50689c7d to your computer and use it in GitHub Desktop.
[Theming Snippets] Change number of upsells output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Change number of upsells output | |
| */ | |
| add_filter( 'woocommerce_upsell_display_args', 'wc_change_number_related_products', 20 ); | |
| function wc_change_number_related_products( $args ) { | |
| $args['posts_per_page'] = 1; | |
| $args['columns'] = 4; //change number of upsells here | |
| return $args; | |
| } |
Kevin is right. The woocommerce_output_related_products_args will not affect the Upsells on the actual Product page.
Use the woocommerce_upsell_display_args filter instead.
Can we just ban Woo from the internet and save the world from this kind of incompetence? If monkeys had keyboards...
add_filter( 'woocommerce_upsell_display_args', 'custom_woocommerce_upsell_display_args' );
function custom_woocommerce_upsell_display_args( $args ) {
$args['posts_per_page'] = 4;
$args['columns'] = 4;
return $args; }
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The filter should be
woocommerce_upsell_display_args