Currently when a line item is duplicated, it doesn't take into account any changes to the line item, such as discounts, etc.
The following is around line 210 of commerce_recurring.rules.inc. Please note the three lines I've added to support this. The point is - currently only a base price can recur. This allows the line item amount to recur.
// Create the new product line item.
$new_line_item = commerce_product_line_item_new ($product, $line_item_wrapper->quantity->value(), $recurring_order->order_id);
$new_line_item->line_item_label = t('Recurring !old_label (charged every !interval)',
array ('!old_label' => $new_line_item->line_item_label,
'!interval' => $interval_label));
//BEGIN ADDITION
$new_line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $new_line_item);
$new_line_item_wrapper->commerce_unit_price->amount = $line_item_wrapper->commerce_unit_price->amount->value(); //set the amount
$new_line_item_wrapper->commerce_unit_price->data = $line_item_wrapper->commerce_unit_price->data->value(); //must get the unit price data so the order will update
//END ADDITION
// Save the line item now so we get its ID.
commerce_line_item_save($new_line_item);
// Add it to the order's line item reference value.
$recurring_order_wrapper->commerce_line_items[] = $new_line_item;<em></em>
Comments
Comment #0.0
SolomonGifford commentedset the new lines formatting
Comment #1
larowlanHi
Can you attach this as a patch?
Thanks
Comment #2
SolomonGifford commentedHere it is.
Comment #3
thtas commentedWorks well,
Thanks for the patch.
Comment #4
jpstrikesback commentedI think this would be perfect if it had a settings form item to enable/disable like:
Allow line item price changes to recur for newly created recurring orders
- Never (default)
- Always
- Per Product (would need to hook into the product creation form here)
Would that make sense?
Comment #4.0
jpstrikesback commentedditto
Comment #5
dafederPatch no longer applies. Is there any progress on this behavior occurring elsewhere?
Comment #6
bojanz commented