Zen Cart custom software development, Zen Cart modules, Zen Cart Expert eCommerce with Zen Cart!

Zen Cart Optional Payment Method

Zen Cart Optional Payment Method

A Zen Cart™ mod which copies sidebox settings from one template to another.

Donate: This is free software. Show your appreciation by supporting my efforts. Donate

Relevance: Zen Cart™ 1.5.1 and above

Current Version: 1.2 (version history)

Support Thread: Optional Payment Method Support Thread

Cost: Free, but donation appreciated

Installed Cost: $60.00 Buy Professional Installation by That Software Guy

Installation Difficulty: Moderate

Installation Instructions: click here

Location: Zen Cart Plugins, under Admin Tools

Download: Optional Payment Method in Zen Cart Plugins


If you have a payment method that you want only certain customers to have access to, this module will help you do that.

It adds a checkbox (defaulted to unchecked) permitting the use of another payment module to the Admin > Customers > Customers screen. Zen Cart Optional Payment in Edit Customer screen

Installation Instructions:

  1. Back up everything! Try this in a test environment prior to installing it on a live shop.
  2. Unzip the file you have received.
  3. In Admin > Tools > Install SQL Patches, run optional_payment.sql.
  4. In your copy of includes/classes/payment.php, in the first instance of the line
       $class = substr($value, 0, strrpos($value, '.')); 

    For Zen Cart 1.3.9 through 1.5.3, this is line 50
    Add the following logic below that line:
                  // bof optional payment method logic 
                  if ($class == 'braintree_api') {
                     global $db;
                     $cid = $_SESSION['customer_id'];
                     $class_ok = $db->Execute("SELECT optional_payment_1 FROM " . TABLE_CUSTOMERS . " WHERE customers_id = " . (int)$cid);
                     if ($class_ok->fields['optional_payment_1'] != 1) {
                  // eof optional payment method logic 
    Change braintree_api to the name of the payment module you want to be optional.
  5. Install admin/customers.php. Change the string "Allow use of BrainTree CC Module?" to one of your own choosing.
  6. If you want to allow customers to decide whether or not to show this payment module, just add the ability to get/set optional_payment_1 to the account_edit page and template.
  7. Donate! Show your appreciation by supporting my efforts.

Major Versions

  • 1.2 01/02/2015 - Updates for Zen Cart 1.5.5a
  • 1.1 01/02/2015 - Updates for Zen Cart 1.5.4.
  • 1.0 12/01/2014 - First Release


Q: What are some ways I could further customize this mod?
A: This post provides some ideas.

Q: Could I use this in the Invoice Payment Method mod to determine eligibility, rather than using the customer's group id?
A: Yes! That's exactly the idea.