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

SolomonGifford’s picture

Issue summary: View changes

set the new lines formatting

larowlan’s picture

Status: Active » Postponed (maintainer needs more info)

Hi
Can you attach this as a patch?
Thanks

SolomonGifford’s picture

Here it is.

thtas’s picture

Works well,

Thanks for the patch.

jpstrikesback’s picture

I 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?

jpstrikesback’s picture

Issue summary: View changes

ditto

dafeder’s picture

Patch no longer applies. Is there any progress on this behavior occurring elsewhere?

bojanz’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)