There are a couple of attributes in my product. If the product is added to the cart without choosing one or two attributes, the product goes to the cart, but unselected attributes are also showing up.

I want that attributes without values are not shown. How can I do this? I tried using hook_product_description(), but it doesn't help.

I'm using Ubercart 6.x-2.7, and its Product attributes module.

  • This doesn't seem to make much sense to me. Maybe you could rewrite your question?
    – Chapabu
    Jan 31, 2012 at 11:48
  • 1
    You need to write more context, what modules are you using ect.
    – googletorp
    Jan 31, 2012 at 12:22

1 Answer 1


Create a module to customize the cart form. Here's how I usually do it.

function custom_cart_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'uc_cart_view_form') {

       //these are rows in your cart... that includes the "total" line etc, so make sure to check that the row has the data you need

       //I believe what you're looking for is in $form['items'][$i]['desc']['#value']
       //you're going to need to look for the empty tag, probably using a regex pattern and remove the whole <li> element


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.