• I just cannot seem to change the upsell posts per page from -1 to 3
    I use this code:

    //change upsell count
    	function my_cross_sell() {
    		$args = array(
    			'posts_per_page' 	=> 3,
    			'columns' 			=> 3,
    		);
    		return $args;
    	}
    	add_filter( 'woocommerce_upsell_display_args', 'my_cross_sell' );

    whats wrong here?

    https://wordpress.org/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Upsells are the ones shown on product pages, you’re aware?

    function my_cross_sell( $args ) {
    		$args['posts_per_page'] = 3;
    		$args['columns'] = 3;
    		return $args;
    	}
    	add_filter( 'woocommerce_upsell_display_args', 'my_cross_sell' );
    Thread Starter boriskamp1991

    (@boriskamp1991)

    Thanks for you reply,

    yes I am aware, I want the owner to be able to select his own product to show underneath a product in content-single-product
    Should I do this with the upsells or crosssells?

    either way, I tried your code and still get outputted four items (I have selected four items in the backend for the single product to check this.

    related products wont work as they are chosen by category etc

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    cross sells are shown on product pages, up sells are shown on cart.

    Thread Starter boriskamp1991

    (@boriskamp1991)

    yeah, thats what I though, however add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); shows cross sells on the cart page? or do they use the same template?

    I still don’t know how to set the posts per page to 3 instead of the standard -1 (unlimited) though for either cross sells or upsells
    the code from you first answer did not work

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Derp I got it back to front :p For the CROSS sells, (cart page my bad), you can control columns and limit with:

    woocommerce_cross_sells_columns
    woocommerce_cross_sells_total

    https://github.com/woothemes/woocommerce/blob/master/templates/cart/cross-sells.php#L33

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘change upsell posts_per_page’ is closed to new replies.