Jump to content

Make COD payment only for certain region


Recommended Posts

Would be great if I could BIND Cash-On-Delivery PAYMENT only for certain zone. (Nobody sends goods 1000 miles far with courier... Especially if goods are NOT PAID YET) :-D

All we need is to make ONE CHECKBOX in COD configuration...

Can anyone code this?

===

(it's possible to do this using GROUPS, but in this case we need to ADD CUSTOMERS TO A GROUP MANUALLY - not good solution)

Link to comment
Share on other sites

But I need to allow NOT THE COUNTRY, just ONE CITY in the country (where the stock is located).
And REST PART of the country must be restricted. This must be done with ZONES (or states).

This is especially for COURIER delivery. Courier delivery comes together with Cash-On-Delivery, isn't it.
And YOU NEVER SEND COURIER TO ANOTHER CITY.

Link to comment
Share on other sites

No. This will not help.
Because you need to bind it to customer address, delivery, carriers etc etc. Cities ARE cities, countries ARE countries.

We need just a little coding here.

So let's wait what coders say...

Link to comment
Share on other sites

So GUYS, you can modify your COD module like this:



    public function hookPayment($params)
   {

       if (!$this->active)
           return ;

       global $smarty, $cart;

       //SET CARRIER IDs - TO NOT TO SHOW THIS COD MODULE (for example - 24 was POSTAL SERVICE, so COD is not needed.
       //ADD AS MANY IDs AS YOU WANT TO RESTRICT. 
       if ($cart->id_carrier == 24) return ;





This is the simpliest way. Of course, better to put some dialogues into module's interface - but don't have enough time and nervous to analyse all code. But this works too... ;)

ACTUALLY, COD MODULE without this is unusable. Because it acts "theoretically". I mean, THEORETICALLY you send goods by courier to another city. But PRACTICALLY - you do not (only of you have STOCK in that city).

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

So GUYS, you can modify your COD module like this:

 

 

 

	public function hookPayment($params)
{

	if (!$this->active)
		return ;

	global $smarty, $cart;

	//SET CARRIER IDs - TO NOT TO SHOW THIS COD MODULE (for example - 24 was POSTAL SERVICE, so COD is not needed.
	//ADD AS MANY IDs AS YOU WANT TO RESTRICT.
	if ($cart->id_carrier == 24) return ;

 

 

 

This is the simpliest way. Of course, better to put some dialogues into module's interface - but don't have enough time and nervous to analyse all code. But this works too... ;)

 

ACTUALLY, COD MODULE without this is unusable. Because it acts "theoretically". I mean, THEORETICALLY you send goods by courier to another city. But PRACTICALLY - you do not (only of you have STOCK in that city).

 

Hey Jo! Thanks for your code. Could you please let me know the code in case I want to restrict the cash on delivery module to certain postcodes (in billing address)? I am new to prestashop, so don't have very much idea about how this works.

Link to comment
Share on other sites

  • 3 months later...
  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...