You are here

function hook_add_to_cart_data in Ubercart 5

Same name and namespace in other branches
  1. 6.2 docs/hooks.php \hook_add_to_cart_data()

Add extra information to a cart item's "data" array.

This is effectively the submit handler of any alterations to the Add to Cart form. It provides a standard way to store the extra information so that it can be used by hook_add_to_cart().

Parameters

$form_values: The values submitted to the Add to Cart form.

Return value

An array of data to be merged into the item added to the cart.

2 functions implement hook_add_to_cart_data()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

uc_attribute_add_to_cart_data in uc_attribute/uc_attribute.module
Stores the customer's choices in the cart.
uc_product_add_to_cart_data in uc_product/uc_product.module
Implementation of hook_add_to_cart_data().
5 invocations of hook_add_to_cart_data()
uc_cart_links_process in uc_cart_links/uc_cart_links.module
uc_catalog_buy_it_now_form_submit in uc_product/uc_product.module
uc_order_edit_products in uc_order/uc_order.module
Populate the product add/edit div on the order edit screen.
uc_product_add_to_cart_form_submit in uc_product/uc_product.module
Submit handler for uc_product_add_to_cart_form.
uc_product_kit_add_to_cart in uc_product_kit/uc_product_kit.module

File

docs/hooks.php, line 70
These are the hooks that are invoked by the Übercart core.

Code

function hook_add_to_cart_data($form_values) {
  $node = node_load($form_values['nid']);
  return array(
    'module' => 'uc_product',
    'shippable' => $node->shippable,
  );
}