0

I used module "No payment required" for giving extra payment method as per my client requirement.

I created a site with two user roles: 1. Merchant, 2. Customer.

Option "No payment required" should only display to users with "Customer" role, which is given permission by Merchant. I have searched in google but there is no luck.

1 Answer 1

1

In Drupal Commerce each payment method is essentially a rule. So just like with any rule, you'll need to add your required condition to that payment method rule.

Find Payment Method Configuration page - admin/commerce/config/payment-methods.

You'll see payment method "No Payment Required (Payment)" in the list of "Enabled payment method rules" (if it is enabled). If not enabled - enable that payment method.

Then click Edit next to that rule, and add condition "User has roles". Select the role "Customer", save, test and you're done.

5
  • Thanks for your reply @oksana. Yes I did as per your suggestion but my requirement is not fulfilled and I also want to explain more that Merchant have some customer and they will select whether they wish to offer the No Payment Required option to all of their customers or not to offer it at all. I want to give one option like "Enable option of No payment Required" to Merchant and Merchant check this option then this option will display on checkout page for their customers. Got my point? Again thanks. Commented May 18, 2016 at 7:14
  • @RahulYadav The idea of enabling payment option for any user is the same as described above. You going to use Rules conditions to allow the payment. The method of how to differentiate who will be able to use that payment option is up to you to solve. Without going any deeper into your implementation, one of the ways you could achieve this, is by creating a checkbox field on Customer's profile. If Merchant checks the checkbox on the certain profile, then the user will be allowed to use "No Payment" option.
    – oksana-c
    Commented May 18, 2016 at 10:01
  • You'll need to set up permissions for editing that specific field or some other logic, so that Customer's wouldn't be able to edit it themselves. Then just check if the field if checked in the payment method rule as described above. This should give you a good starting point.
    – oksana-c
    Commented May 18, 2016 at 10:02
  • @ oksana-c Thanks for giving your suggestion. I did implement same and achieved success to make functionality as I shared with you. Commented May 23, 2016 at 3:48
  • @RahulYadav - You're welcome. Glad it helped.
    – oksana-c
    Commented May 23, 2016 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.