Advertisement
lorro

WooCommerce - Change upsells arguments

Jul 17th, 2017
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement