hook_add_to_cart_data

Definition

hook_add_to_cart_data($form_values)
ubercart/docs/hooks.php, line 70

Description

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.

Related topics

Namesort iconDescription
HooksAllow modules to interact with the Drupal core.

Code

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