Skip to content

Instantly share code, notes, and snippets.

@lsolesen
Created December 10, 2012 19:46
Show Gist options
  • Save lsolesen/4252848 to your computer and use it in GitHub Desktop.
Save lsolesen/4252848 to your computer and use it in GitHub Desktop.
// Add any selected training.
if (!empty($form_state['values']['kayak']) && is_numeric($form_state['values']['kayak']) && $form_state['values']['kayak'] != 'none') {
$line_item = NULL;
if ($product = commerce_product_load(check_plain($form_state['values']['kayak']))) {
$line_item = commerce_product_line_item_new($product, check_plain($form_state['values']['quantity']), check_plain($form_state['line_item']->order_id$
commerce_line_item_save($line_item);
$line_item->field_wetsuit_size[LANGUAGE_NONE][0]['value'] = check_plain($form_state['values']['wetsuit_size']);
$line_item->field_registrant_name[LANGUAGE_NONE][0]['value'] = check_plain($form_state['values']['line_item_fields']['field_registrant_name'][LANGUA$
commerce_line_item_save($line_item);
$line_item = commerce_line_item_load($line_item->line_item_id);
$combine_products = FALSE;
commerce_cart_product_add($user->uid, $line_item, $combine_products);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment