Jump to content

Hide payment method until the customer made an order with another payment method


SublimeProphets

Recommended Posts

Hi folks

 

I've got a question and i did not found any solution or an addon for it, but maybe one of you folks has a idea how to solve that.

 

We got a lot of bad orders with the cash on delivery method. Some new customers do not understand the cash on delivery really well, which ending up with additional costs for us. 

 

The best way to prevent that would be to hide the payment method until the customer ordered successfully something with any of the other payment methods.

 

Is there an easy way to do it - maybe an existing addon or just a variable like $isFirstOrder which i could check in the template and hide it accordingly? We are using the COD+ module (which is free here in the addon store..)

 

Thanks for all feedback!

 

Greets Sublime

Link to comment
Share on other sites

The best way to prevent that would be to hide the payment method until the customer ordered successfully something with any of the other payment methods.

 

 

 

Do you mean hide for new customer but show it for returning customers?

If should be not easy to add following line of code at beginning inside method hookDisplayPayment() in your module.

 

if(count(Order::getCustomerOrders($this->context->customer->id)) == 0)return;

 

 

  • Like 1
Link to comment
Share on other sites

While the above is an easy solution, it does involve minor coding, and then maintenance of that code when you upgrade the module, unless you figure out module overrides.

 

The alternative would be to use customer groups.  This would require some more work, but you could add customers to a new customer group after they make their first purchase.  Then you would configure the COD module to only appear for customers in this new group.

 

You could take that a step further, and create a module that listens for new orders, and automatically moves those customers to this new group.

Link to comment
Share on other sites

  • 1 month later...

Do you mean hide for new customer but show it for returning customers?

If should be not easy to add following line of code at beginning inside method hookDisplayPayment() in your module.

 

That's exactly the solution i've looked for. I just implemented it and it works like a charm! The solution with the different groupes seemed to be a totally overhead for that.

 

Thanks a lot :)

Link to comment
Share on other sites

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...