I'm wondering if it's possible to setup a recurring product feature to be shippable when the recurring fee gets triggered.

Right now it just creates the renewal product in the order product array, but no shippable flag. I can hook into order pre-save and hack the product data array, but I was wondering if there was a better approach to this.

Any insight would be greatly appreciated.

Comments

mmilano’s picture

Here's a quick work-around that sets the recurring fee product to be shippable based on if its parent product is shippable. I needed this so the order actions show the shipment icons, as well as other workflow around shippable orders.

Ideally, there would be a checkbox in the fee section to take on the shipment attributes of the parent product.

/**
 * Implements hook_uc_order().
 */
function mymodule_uc_order($op, $order, $arg2) {
  switch ($op) {
    case 'presave':
      foreach ($order->products as $pid => $product) {
        if (isset($product->data['recurring_fee'])) {
          $base_product = node_load($product->nid);
          $order->products[$pid]->data['shippable'] = $base_product->shippable;
        }
      }
      break;
  }
}