As part of a module I've created, I'm restricting the zip code permitted for delivery address to a admin determined list. I implement hook_order to block the order from going thru:
<?php
function mymodule_order($op, &$arg1, $arg2) {
switch ($op) {
case 'submit':
$allowed_zips = explode(',',variable_get('mymodule_zip_codes','10001,10002,10003'));
if (!in_array($arg1->delivery_postal_code,$allowed_zips)) {
return array(array('pass' => FALSE, 'message' => t('Sorry, but we don\'t deliver to the address you entered. Please !contact for more information.',
array('!contact'=>l('contact us', 'contact')
))));
}
break;
}
}
?>This properly returns me to the checkout screen when submitting the review screen with an invalid address, however the card is still charged! I assume this is because the payment module's hook is still getting called. Is there a built in way to prevent the order from being charged and advanced?




Joined: 09/29/2008