autoship_create_scheduled_order_item_product_sale_price
( src > orders.php ) Can be used to modify the sale price (recurring price) for a product on a Scheduled 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_sale_price', 'xx_discount_based_on_frequency', 10, 4);