How can I change the Coupon label and description in the checkout pane?
I tried to user hook_form_alter but it is not working.
I've tried form_id commerce_coupon_pane_checkout_form and commerce_product_ui_product_form.

Is there a different way to do this?

Comments

skchan2’s picture

Id like to know this also, I want to change "Enter here your coupon code" to "Enter your coupon code here"

kruser’s picture

I was able to hook_form_alter to change this...

function custom_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'commerce_checkout_form_checkout':
      $form['commerce_coupon']['coupon_code']['#description'] = t('Enter your coupon code here.');
    break;
  }
}
millionleaves’s picture

Would be handy if the ability to change (or remove) the instructions were exposed in the module configuration page, or perhaps in the 'Coupons' checkout panes configuration screen.

At the every least, could I suggest changing the hard-coded label to the grammatically more correct: "Enter your coupon code here".

UPDATE: confirmed that the method outlined in #2 works. I created a custom module including this function and was able to override the form label with that. I still have to open up a module file to make changes, but at least this is better than changing the commerce_coupon module code and having it overridden next time I upgrade the module.

leewillis77’s picture

There's an issue (With patch) here https://drupal.org/node/2112905#comment-7970437 that covers some of this.

Once this is installed, the strings should be translatable, which would mean you could change them using String Overrides module (http://drupal.org/project/string_override). It also changes the grammar of the string you identified.

sureshpotnuru’s picture

Issue summary: View changes

yes, correct leewillis77. but you finds module at https://www.drupal.org/project/stringoverrides. Thanks for save my day.