wpsc_coupon_select_item_field

Located in: coupons.class.php

Functions that call this hook: calculate_discount_conditions()

Arguments Accepted: 'unit_price'

Version Introduced: 3.8.9

Description: If “Apply on all products” is not checked and the coupon is percentage, the discount amount should be based on the eligible cart item with lowest unit price. Use this filter to change which field the discounted percentage should be based on.

Code in context:

[php firstline=”415″ highlight=”418″]

// if "Apply on all products" is not checked and the coupon is percentage, the discount

// amount should be based on the eligible cart item with lowest unit price

if ( $this->is_percentage() ) {

$field = apply_filters( ‘wpsc_coupon_select_item_field’ , ‘unit_price’ );

$item = array_shift( $items );

return $item->$field * $this->value / 100;

}

[/php]