You are here

function commerce_cart_add_to_cart_form_after_build in Commerce Core 7

After build callback for the Add to Cart form.

1 string reference to 'commerce_cart_add_to_cart_form_after_build'
commerce_cart_add_to_cart_form in modules/cart/commerce_cart.module
Builds an Add to Cart form for a set of products.

File

modules/cart/commerce_cart.module, line 2581
Implements the shopping cart system and add to cart features.

Code

function commerce_cart_add_to_cart_form_after_build(&$form, &$form_state) {

  // Remove the default_product entity to mitigate cache_form bloat and performance issues.
  if (isset($form_state['default_product'])) {
    $form_state['default_product_id'] = $form_state['default_product']->product_id;
    unset($form_state['default_product']);
  }
  return $form;
}