Last active
October 21, 2015 16:09
-
-
Save joshmiller83/e504444f41b76b8fbf1d to your computer and use it in GitHub Desktop.
A quick example of how to use hook form alter to change the add to cart form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_form_alter() | |
*/ | |
function THEMENAME_form_alter(&$form, &$form_state, $form_id) { | |
if (strpos($form_id,"cart_add_to_cart")) { | |
// load the node that is rendering the cart form | |
$node = node_load(array_pop(explode('_',$form_id))); | |
// hide the form | |
$form['#access'] = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment