You are here

function commerce_pado_add_to_cart_submit in Commerce Product Add-on 7

1 string reference to 'commerce_pado_add_to_cart_submit'
commerce_pado_form_commerce_cart_add_to_cart_form_alter in ./commerce_pado.module
Implementation of hook_form_FORM_ID_alter().

File

./commerce_pado.module, line 168
Commerce Product Add On adds an option to entityreference fields that allows selected products to act as "add-ons" for the parent product.

Code

function commerce_pado_add_to_cart_submit($form, &$form_state) {
  $commerce_pado_products = $form_state['commerce_pado_products'];
  $quantity = $form_state['values']['quantity'];
  foreach ($commerce_pado_products as $product_add_on) {

    // If the product was checked in the add to cart form...
    if ($form_state['values'][$product_add_on->sku] == 1) {

      // Trigger the rule event
      rules_invoke_event('commerce_pado_add_to_cart', $product_add_on, $quantity);
    }
  }
}