Skip to content

Instantly share code, notes, and snippets.

@chered
Last active August 29, 2015 14:06
Show Gist options
  • Save chered/57ee539de365bbe8e6e3 to your computer and use it in GitHub Desktop.
Save chered/57ee539de365bbe8e6e3 to your computer and use it in GitHub Desktop.
simple drupal module to change text on add to cart button (filter by page url)
//changecarttext.info
name = change text of add to cart
description = add to cart
package = custom
core = 7.x
files[] = changecarttext.module
//changecarttext.module
<?php
/* @file
* A module changing text on add to cart button.
*
*/
/**
* Implements hook form alter on commerce_cart_add_to_cart_form() for specific page "/deals".
*/
function changecart_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state, $form_id) {
if ($_GET['q'] == 'deals') {
$form['submit']['#value'] = t('Buy Now');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment