Title: Postal/Pin Code include/exclude not working!
Last modified: August 30, 2016

---

# Postal/Pin Code include/exclude not working!

 *  Resolved [Sanam Patel](https://wordpress.org/support/users/sanampatel/)
 * (@sanampatel)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/postalpin-code-includeexclude-not-working/)
 * Hello!
 * I added some 4k-5k pincodes in Postal/Pin codes to hide COD list and then selected
   the option for **Postal/Pin Code include/exclude?** to **Display COD if user 
   is from above postal code** but that option is not working no matter which thing
   I select in option.
 * Otherwise I just loved the plugin.
 * [https://wordpress.org/plugins/woocommerce-cod-advanced/](https://wordpress.org/plugins/woocommerce-cod-advanced/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [Sanam Patel](https://wordpress.org/support/users/sanampatel/)
 * (@sanampatel)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/postalpin-code-includeexclude-not-working/#post-6309600)
 * Hey!
 * I just found the solution for the same, it’s small coding error.
 * In line number 353 & 356 replace the “**in_ex_city**” with word “**in_ex_pincode**“
 * from line 346 to 360 code should be changed to this :
 *     ```
       if($cod_enabled && $cod_pincodes){
       	$cod_pincodes_arr = explode(',',$cod_pincodes);
       	if($customer_detail['s_city']){
       		$shipping_postcode = trim($customer_detail['s_postcode']);
       	}else{
       		$shipping_postcode = trim($customer_detail['shipping_postcode']);
       	}
       	if($shipping_postcode && $in_ex_pincode=='include' && !in_array($shipping_postcode,$cod_pincodes_arr)){
       		unset($gateways['cod']);
       		$cod_enabled=0;
       	}elseif($shipping_postcode && $in_ex_pincode=='exclude' && in_array($shipping_postcode,$cod_pincodes_arr)){
       		unset($gateways['cod']);
       		$cod_enabled=0;
       	}
       }
       ```
   
 * Hope this will work for next update of this plugin.
 *  [chinnia](https://wordpress.org/support/users/chinnia/)
 * (@chinnia)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/postalpin-code-includeexclude-not-working/#post-6309815)
 * Hi Sanam,
 * I have a strange issue, the cod option works well while I am logged in as the
   admin. It does not hide COD for restricted pin codes when i am not signed in.
 * Could you suggest something please ? It is urgent.
 * Please help. Thanks in advance.
 *  [pinkpiki123](https://wordpress.org/support/users/pinkpiki123/)
 * (@pinkpiki123)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/postalpin-code-includeexclude-not-working/#post-6309819)
 * I’m having ssue with this plugin.. overall plugin is good.
 * I ve include 2 pincodes in field also include the city and country and state..
 * also added the cod msg .. but when I enter the included pincode city and country
   it display cod disable msg …
 *  Plugin Author [aheadzen](https://wordpress.org/support/users/aheadzen/)
 * (@aheadzen)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/postalpin-code-includeexclude-not-working/#post-6309822)
 * Hi there,
 * Thanks for your co-operation. We have added correction in the plugin.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Postal/Pin Code include/exclude not working!’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woocommerce-cod-advanced.svg)
 * [WooCommerce COD Advanced Plugin](https://wordpress.org/plugins/woocommerce-cod-advanced/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-cod-advanced/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-cod-advanced/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-cod-advanced/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-cod-advanced/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-cod-advanced/reviews/)

## Tags

 * [COD](https://wordpress.org/support/topic-tag/cod/)
 * [order](https://wordpress.org/support/topic-tag/order/)

 * 4 replies
 * 4 participants
 * Last reply from: [aheadzen](https://wordpress.org/support/users/aheadzen/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/postalpin-code-includeexclude-not-working/#post-6309822)
 * Status: resolved