Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently the label for the Webform "Submit" button is changed to "Add to cart" in .module:
function commerce_webform_form_alter(&$form, &$form_state, $form_id) {
if (stripos($form_id, 'webform_client_form') === 0) {
if (commerce_webform_is_commerce_webform($form['#node'])) {
//$form['actions']['submit']['#value'] = !$form['#is_draft'] && !empty($form['#submission']) ? t('Update cart') : t('Add to cart');
}
}
}
So to change the label one now has to write a function commerce_webform_form_alter, as the Webform -> Form settings -> Advanced Settings -> Submit button text can't be used anymore to set this label.
It would be great to remove this hook from .module - then users have full control over the label through the standard Webform GUI. In our case e.g. for one project we don't do carts - we do a Submit & Pay -> straight to /checkout.
Comment | File | Size | Author |
---|---|---|---|
#3 | commerce_webform-removed_alter_submit_button_text_in_2x-2071327-3.patch | 759 bytes | johnennew |
#2 | commerce_webform-remove_automatic_setting_of_submit_button-2071327-1.patch | 759 bytes | johnennew |
Comments
Comment #1
johnennew CreditAttribution: johnennew commentedHi @KarinG - I think you are right. I have committed the attached patch to 7.x-1.x-dev.
Comment #2
johnennew CreditAttribution: johnennew commentedoops, forgot the patch
Comment #3
johnennew CreditAttribution: johnennew commentedAlso removed from 2.x branch.
Comment #4
KarinGMerci!
-- Karin