Advertisement
lorro

WooCommerce - Change upsells parameters

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