Function hook_cart_item() in uc_cart.module:
($op, &$item)


Products that are added to a customer's cart are referred as items until the sale is completed. Just think of a grocery store having a bunch of products on the shelves but putting a sign over the express lane saying "15 Items or Less." hook_cart_item() is in charge of acting on items at various times like when they are being added to a cart, saved, loaded, and checked out.

Here's the rationale for this hook: Products may change on a live site during a price increase or change to attribute adjustments. If a user has previously added an item to their cart, when they go to checkout or view their cart screen we want the latest pricing and model numbers to show. So, the essential product information is stored in the cart, but when the items in a cart are loaded, modules are given a chance to adjust the data against the latest settings.

  • $op - The action that is occurring. Possible values:
    • load - Passed for each item when a cart is being loaded in the function uc_cart_get_contents(). This gives modules the chance to tweak information for items when the cart is being loaded prior to being view or added to an order. No return value is expected.
    • can_ship - Passed when a cart is being scanned for items that are not shippable items. Ãœbercart will bypass cart and checkout operations specifically related to tangible products if nothing in the cart is shippable. hook_cart_item functions that check for this op are expected to return TRUE or FALSE based on whether a product is shippable or not.
  • $item - Object reference to the item in the cart.
Return value:
No return value for load. TRUE or FALSE for can_ship.

function uc_manufacturer_cart_item($op, &$item) {
  switch (
$op) {
$term = array_shift(taxonomy_node_get_terms_by_vocabulary($item->nid, variable_get('uc_manufacturer_vid', 0)));
$arg1->manufacturer = $term->name;