Do give a cheaper unit price if more than 1 is purchased
//Add $100 discount per item if quantity = 2 or more
add_action( 'woocommerce_before_calculate_totals', 'ns_add_bulkcustom_price', 10, 1);
function ns_add_bulkcustom_price( $cart_obj ) {
// This is necessary for WC 3.0+
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
foreach ( $cart_obj->get_cart() as $key => $value ) {
//Only action on Product 827
if ($value['product_id'] == 827) {
$regprice = $value["data"]->get_price();
echo '<pre>';
print_r( $regprice-100);
echo '</pre>';
if ($value['quantity'] > 1) {
$value['data']->set_price( $regprice-100 );
}
}
}
}