Warning message

Newsletter category Drupal Developer newsletter format has not been set to HTML. There will be no statistics recorded for this newsletter.

Drupal: Add product field on cart for Ubercart

This CodeLet let you display product field on cart page.


* Implementation of hook_form_alter
* @param $form
* @param $form_state
* @param $form_id
* @saru1683
function custom_uc_tax_remove_form_alter(&$form, &$form_state, $form_id) {

switch($form_id) {
case 'uc_cart_view_form':

// Adding Product field column
$form['items']['']['Edition'] = array('cell' => t('Edition'), 'weight' => 2.5);

for($i=0; $i < count($form['items']); $i++) {
if(isset($form['items'][$i]['nid'])) {

// Loading the node so we can retrieve the information we need.
$product = node_load($form['items'][$i]['nid']['']);

$ss__edition = $product->field_product_fieldl['und'][0]['value'];

// Adding the 'Product field' to the cart form, that is in the user's cart.
$form['items'][$i]['Edition'] = array('' => $ss__edition);


Display Product field on cart table

By saru1683 on Sat, 04/01/2014 - 11:31am

Add comment

Log in or register to post comments
QR code for this page URL This page URL