daily pastebin goal
68%
SHARE
TWEET

WooCommerce - Change upsells arguments

lorro Jul 17th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // WooCommerce - Change upsell arguments
  3. // remove upsells using same priority as original add_action()
  4. remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
  5. // add custom upsells function in the same place
  6. add_action( 'woocommerce_after_single_product_summary', 'custom_upsell_display', 15 );
  7. function custom_upsell_display() {
  8.   // default parameters:
  9.   // woocommerce_upsell_display( $limit = '-1', $columns = 4, $orderby = 'rand', $order = 'desc' )
  10.   // call it with my parameters
  11.   woocommerce_upsell_display( -1, 4, 'price', 'asc' );
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top