brnsk Posted November 5, 2020 Share Posted November 5, 2020 Hi! I'm running PS 1.6.18 and have many customer groups in my shop. What I need to do is to disable a specific payment method (it's a separate module) for a specific customer group while this payment method stays available for all other customers (also not registered). It needs to work like that: if a customer belongs to XXX group >>> do not show YYY payment method. Standard customer group module availability tool doesn't help here. Any tips how to solve this problem? Cheers! Link to comment Share on other sites More sharing options...
jetway Posted November 6, 2020 Share Posted November 6, 2020 (edited) Go to Payment -> Preferences -> Group restrictions and enable whichever Payment Options should be available for the Group in discussion. Edited November 6, 2020 by jetway (see edit history) Link to comment Share on other sites More sharing options...
brnsk Posted November 16, 2020 Author Share Posted November 16, 2020 (edited) @jetway It doesn't work like this unfortunately. Let me explain that with an example. Let's say I have a 'NoCreditCard' customer group in my shop for customers that I don't want to to pay with credit cards. Yet these customers belong also to the default 'Customer' group. And what I want to achieve is to make credit card payment available for all customers besides these that belong to 'NoCreditCard' group. If I make credit card payment unavailable for 'NoCreditCard' group in payment preferences, customers that belong to this group still get this payment option because they also belong to the default 'Customer' group (and I don't want to kick them out of the default group because then many features stop working as they should). I'd be grateful for a suggestion where in the code should I apply a rule like: if a customer belongs to XXX group >>> do not show YYY payment method Edited November 16, 2020 by brnsk (see edit history) Link to comment Share on other sites More sharing options...
Gianluca-Lorenz Posted December 6, 2022 Share Posted December 6, 2022 (edited) Hello, I would like to resume this discussion because I have the same problem too (Prestashop 1.7.4.3): the problem is that, just like @brnsk wrote, Prestashop restriction of the payment method works based on all groups to which the user belongs, and this causes the restriction not to work properly. The restriction should work based only on the DEFAULT customer group. Anyone knows how to do it? Thank you. Edited December 6, 2022 by Gianluca-Lorenz (see edit history) Link to comment Share on other sites More sharing options...
Knowband Plugins Posted December 7, 2022 Share Posted December 7, 2022 For restricting the specific Group from the credit card payment, kindly try by adding the below code in the main file of the credit card payment module, Function : hookPaymentOptions($params) =>First Fetch the group using the below code $customer_id = context::getContext()->customer->id; $group_ids = Customer::getGroupsStatic((int)$customer_id); =>Then check whether the group belongs to the "NoCreditCard" Group, if yes then use the below code return; The above code will check whether the group of the customer is belong to the "NoCreditCard" Group , if yes then that payment method is not available on the front for that customer, otherwise the payment method is available. Link to comment Share on other sites More sharing options...
Gianluca-Lorenz Posted December 13, 2022 Share Posted December 13, 2022 Hello @Knowband Plugins thank you for your answer but, what about the issue related to the Prestashop core payment's restriction feature (Improve > Payment > Setting > Group limitations) ? How can we correct the default Prestashop behaviour to tell the system to take in consideration ONLY the default customer group and not all the groups to which the customer belongs? Thanks again. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted December 14, 2022 Share Posted December 14, 2022 @Gianluca-LorenzGenerally the system works according to the customer Groups restriction. We are not sure why that functionality doesnt work at your end, maybe due to any customisation it doesnt work. Kindly check the same with a fresh Prestashop, It will definately work fine. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now