autoship_create_scheduled_order_item_product_price
Can be used to modify the regular price for an order, and takes the following parameters:
- Price
- Frequency
- Frequency Type
- WC Product object as parameters.
Example
// change product price based on more frequent ordering
function xx_discount_based_on_frequency ($item_price, $frequency_type, $frequency,$product) {
if($frequency_type == 'Weeks' && ($frequency == 1 || $frequency == 2)){
$item_price = $item_price - ($item_price * .10);
}
if($frequency_type == 'Weeks' && $frequency == 3 ){
$item_price = $item_price - ($item_price * .05);
}
return $item_price;
}
add_filter('autoship_create_scheduled_order_item_product_price', 'xx_discount_based_on_frequency', 10, 4);