Forcing your checkout process to default currency in Zen Cart


Sometimes, the owners of ecommerce system would like to force the customers to choose store's default/chosen currency and why is that? Because, the instability of worldwide economy may cause the storeowners to loss profits during currency converting. Therefore, the storeowners have to ensure that it doesn't affect them by forcing their customers to select default currency (normally, it's the currency where the storeowner resides) during checkout process.

The easy way is to hide the currency converter pulldown menu once the customer entered the checkout process and set the current currency to your chosen/default currency. The steps explained here assume that currency converter is placed on the header instead of sidebar menu as it's way neater and you have to use the override system to have your own theme:

1. Put the code below on your /includes/templates/your_own_theme/common/tpl.header.php

  1. $checkout_shipping = '/index.php?main_page=checkout_shipping';
  2. $checkout_payment= '/index.php?main_page=checkout_payment';
  3. $checkout_confirm= '/index.php?main_page=checkout_confirmation';
  4. $request_url=$_SERVER['REQUEST_URI'];
  5.  
  6. if ($request_url == $checkout_shipping || $request_url == $checkout_payment || $request_url == $checkout_confirm)
  7. {
  8. $_SESSION['currency'] = 'AUD';
  9. }

This will get the current url address of your browser, so whenever the customer entered checkout process such as shipping, payment and confirmation then the current currency automatically converted to AUD (you may suit this currency as you please)

2. Place the code below just before your currency converter pulldown menu in the header

  1. $checkout_shipping = '/index.php?main_page=checkout_shipping';
  2. $checkout_payment= '/index.php?main_page=checkout_payment';
  3. $checkout_confirm= '/index.php?main_page=checkout_confirmation';
  4. $request_url=$_SERVER['REQUEST_URI'];
  5.  
  6. if ($request_url != $checkout_shipping && $request_url != $checkout_payment && $request_url != $checkout_confirm) {

This ensures the currency converter pulldown menu will not be displayed during checkout process.

Of course, there is another way to force currency during checkout process, which's to hack into zencart order_total module. However, it is prone to error as you have to hardcode it manually. Furthermore, there is no point of having a currency converter menu during checkout process while you have to essentially force your customers to use your default/chosen currency.