I can't find a clear example of modifying a text attribute for a product when it is added to the cart. I can't use hook_form_alter because I want the attribute value to be changed regardless if the product was added from a form or cart link. I thought I could just do with hook add_to_cart_data but it seems like it needs to be called directly with module_invoke_all?
I've tried:
function mymodule_add_to_cart($nid, $qty, $data) {
$node = node_load($nid);
if ($node->type = 'some_nodetype') {
$data['attributes'][12] = 'change the value text';
uc_cart_add_item($nid, $qty, $data + module_invoke_all('add_to_cart_data', $data), NULL, 'Some Message', FALSE, FALSE);
}
}I just want to change the value of attribute id 12 to some other text string whenever this product is added to the cart. I know I'm missing something simple. Any help is very greatly appreciated.



