I'm trying to add a product to an ubercart order in Drupal 6, for a "free gift for recurring customer". I have already integrated it with ubercart's conditional actions, and that works fine.
What I am struggleing with, is adding the product to the order. I'm able to add the produkt to the cart, using:
uc_cart_add_item($settings[ 'gift_product'], $settings['gift_product_quantity'] );
To avoid fraud, and the customer not just clicking back and change the quantity of the free product, I would like to add it after checkout, so the line will apear on the order confirmation, and when packing the order. (If there is a better way to achieve this, please enlighten me)
The following code, does not add a product line, but a "charge", but it's the closest I have gotten:
uc_order_line_item_add($order->order_id, $settings[ 'gift_product' ], $product->title, $settings[ 'gift_product_quantity']);
As a side thing, I would like to know, if it's possible, and then how, to set the price, on the added product line, or add a 100% discount to that one order line.
I've been searching for a solution for this, for the most of a week, but I can't seem to find the right solution.
Thank you in advance.
I was unable to find any modules doing this, so I ended up making my own. The ubercart cart bonus module, was a great inspiration regarding a possible way to do this: http://drupalmodules.com/module/ubercart-cart-bonus
I did not change the order, but only the cart, and then made the necessary checks to try and prevent fraud.