I'm working on Drupal commerce kickstart.

On Product variation, I need to change the text Enter quantity to Enter your quantities and change Add to Cart to Buy Now.

I tried with form alter it works to change Add to Cart to Buy Now but its not working for Enter quantity to Enter your quantities.

Can any one help on this?


I too had the same problem. Because this text is hardcoded and there is no configuration for updating the text.

Ways to change the text

  • Use String Overrides module.
  • Do a form_alter and change the text from Add to Cart to Buy Now

Form Alter for Enter quantity

function module_name_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'commerce_cart_add_to_cart_form') {
    $form['quantity']['#title'] = t('Enter your Quantities');

Hope this code helps.

| improve this answer | |

This string is being set by a form_alter in the commerce_kickstart_product_ui.module. You can use the module string_overrides: https://drupal.org/project/stringoverrides to change the string, or You can use your own form alter code in a custom module but you may have to use the weight module https://drupal.org/project/modules_weight so that your module executes it's code after te commerce module.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.