Drupal Commerce Rules & Custom Actions When the checkout process is complete I'd like to record the SKU and the user ID in a separate table in my database.

Is the best approach to use the Rules module, using the 'Completing the checkout process' event and writing a custom action?

If so, how would I be best going about this?

Advice on how best to achieve the above would be appreciated.
I don't know of any modules that enable you to write db records in rules actions. 

I guess you could write a custom rules action to write to your custom table and grab all the data in rules but it's just as easy to do something like below using  hook_commerce_checkout_complete:

The trickiest part is obtaining the SKU

&lt;?php
  function hook_commerce_checkout_complete($order) {
    $ow = entity_metadata_wrapper('commerce_order', $order);

    foreach ($ow-&gt;commerce_line_items as $line_item) {
     $sku = $line_item-&gt;commerce_product-&gt;sku-&gt;value();

     $record = array(
      'uid' =&gt; $uid,
      'order_id' =&gt; $order-&gt;order_id,
      'order_numer' =&gt; $order-&gt;order_number,
      'sku' =&gt; $sku,
     );
     drupal_write_record('my_custom_table', $record);
    }
  }
?&gt;


Hope this helps.