LeBlaireau
LeBlaireau

Reputation: 17467

Ubercart and Drupal 7 - hook_add_to_cart

http://www.ubercart.org/docs/api/hook_add_to_cart

I am trying to hook into the add cart functionality of ubercart. I have created stock_control.module and stock_control.info files and enabled the module. In my .module file I have

The first is output but the 2nd is not.

<?php
   dsm('hello1');
     function stock_control_add_to_cart($nid, $qty, $data) {
    dsm('hello2');
     if ($qty > 1) {
    $result[] = array(
  '        success' => FALSE,
  'message' => t('Sorry, you can only add one of those at a time.'),
);
  }
  return $result;
 } 

Upvotes: 3

Views: 1625

Answers (1)

nmc
nmc

Reputation: 8696

I believe the hook in version 7 is hook_uc_add_to_cart.

Upvotes: 5

Related Questions