Zen Cart How to Set Free Site Wide Shipping for Certain Customers

You have a zen cart business that uses group discounts for special customer groups. One of your customer groups is a group for resellers. This group gets free shipping on all items in your store. This Easy Help Zen Cart Tutorial will show you how to add custom php code to your shipping module file to give site wide free shipping for one customer group.

In your favorite plain text editor, open the includes/modules/shipping/freeoptions.php file. Be sure to back this file up and make a note that you have edited it for future upgrades since it is a zen cart core file.

Find this:


   // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
      }

Add this code on the next line:


// bof: offer only to customers in resellers group
  if (!IS_ADMIN_FLAG) {
    if ($_SESSION['customer_id'] > 0) {
      global $db;
      $group_id_resellers = 1;
      $sql = "SELECT customers_group_pricing from " . TABLE_CUSTOMERS . " WHERE customers_id = '" . $_SESSION['customer_id'] . "'";
      $chk_group_id = $db->Execute($sql);
      if ($chk_group_id->fields['customers_group_pricing'] != $group_id_resellers) {
        $this->enabled = false;
      }
    } else {
      $this->enabled = false;
    }
  }
// eof: offer only to customers in resellers group

So you have this:


      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
      }

// bof: offer only to customers in resellers group
  if (!IS_ADMIN_FLAG) {
    if ($_SESSION['customer_id'] > 0) {
      global $db;
      $group_id_resellers = 1;
      $sql = "SELECT customers_group_pricing from " . TABLE_CUSTOMERS . " WHERE customers_id = '" . $_SESSION['customer_id'] . "'";
      $chk_group_id = $db->Execute($sql);
      if ($chk_group_id->fields['customers_group_pricing'] != $group_id_resellers) {
        $this->enabled = false;
      }
    } else {
      $this->enabled = false;
    }
  }
// eof: offer only to customers in resellers group

      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {

Save your changes and upload the files to your server making sure that you overwrite the files already on your server.

If you need help with your zen cart web siteplease contact us for a quote.

zen cart plus picaflor azul equals success

Leave a Reply