Support Center

How to customize the label of the Drupal Commerce button on the Order Review page

Last Updated: Apr 29, 2014 04:50PM EEST
Drupal Commerce https://drupal.org/project/commerce is used to build eCommerce websites and applications of all sizes based on Drupal.

The Pro and Enterprise releases of our Startup Growth, Mobile+, GenteelBest Brand, MarketSquare, Genteel and Top Hit products come bundled with Drupal Commerce providing you a turnkey e-commerce solution right after installation.

Currently the submit buttons in the Checkout Pages usually say "Continue to next step". This implies that there is another step to go before your Credit Card or your PayPal account is charged. That’s why there is a need for some users to customize the button label to the Review page. It also seems that in some countries, there law for customer protection specifies that the button text itself has to explicitly express that this click is subject to charge. It needs to say "BUY" and words like "Order", "Continue" etc., are not valid.

You can currently change the values for each pane by using the hook_commerce_checkout_page_info_alter(&$pages) and you can achieve something like this by modifying these values in a custom module. Simply follow the instructions below.

Given that our choice of the module name is commerce_overrides:

1. Start the module by creating a folder in your Drupal installation at the path sites/all/modules/commerce_overrides

2. Tell Drupal about your module by creating the commerce_overrides.info file, which should contain the following meta information about the module
 
name = Commerce Overrides
description = Commerce Overrides
package = Commerce (contrib)
dependencies[] = commerce
dependencies[] = commerce_payment
core = 7.x

3. Implement the hook_commerce_checkout_page_info_alter by creating the commerce_overrides.module file, which should contain the following code
 
<?php

function commerce_overrides_commerce_checkout_page_info_alter(&$pages)  {
if(!empty($pages['review'])) {
$pages['review']['submit_value'] = t('Proceed with purchase');
}
}

4. Enable this simple module through the Drupal UI Home » Administration » Modules

5. Here is the new button label




In case this article leaves any of your questions or concerns unanswered, please feel welcome to email us or post a public question.

​More than (just) Themes
http://www.morethanthemes.com/

Contact Us

support-agent@morethanthemes.com
http://assets0.desk.com/
false
morethanthemes
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete