daily pastebin goal
16%
SHARE
TWEET

WooCommerce - Change upsells parameters

lorro Jul 27th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.   // WooCommerce - Change upsells parameters
  3.   // remove the upsells action using the same hook and priority as the original add_action()
  4.   remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
  5.   // add my 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