Fringe Posted February 4, 2021 Share Posted February 4, 2021 Hi, I have some products that are only for customers who already have purchased a service from me, these products are discounted specials and do not appear to non-logged in visitors to the site however I have noted some poeple were are able order and pay for these without having an service already and after some investigation I discovered if they entered the cart URL into a browser it bypassed everything and allowed orders from new people. I asked WHMCS support and they said its not possible to stop this so I wondered if a hook would work. I was could achieve it using the ClientAreaPageCart and a custom hook to check whether a client is logged in and if not, redirect them to the login page. I'm not the best at this so I looked on the documentation and learned if I created a file called client_order.php with the following code... <?php add_hook('ClientAreaPageCart', 1, function($vars) { ???????? }); I'm just not sure what I would put in the ????? part to check if whoever visits that page, if they not logged in as a client then it would direct them back to the homepage. Can anyone help please? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 4, 2021 Share Posted February 4, 2021 7 minutes ago, Fringe said: I have some products that are only for customers who already have purchased a service from me, these products are discounted specials and do not appear to non-logged in visitors to the site you mean that you've ticked the "hidden" checkbox, or have you done something else ? 8 minutes ago, Fringe said: however I have noted some people were are able order and pay for these without having an service already and after some investigation I discovered if they entered the cart URL into a browser it bypassed everything and allowed orders from new people. that would be expected behaviour and I think has always been the case. 11 minutes ago, Fringe said: I asked WHMCS support and they said its not possible to stop this there would certainly be ways to dis-incentivise it without resorting to coding.... one way might be to price these hidden products excessively high to discourage direct purchase, but use a promotion code to reduce the price if the current user already had products x, y or z, or if they're just an existing client etc - whatever is appropriate to our situation. 24 minutes ago, Fringe said: I was could achieve it using the ClientAreaPageCart and a custom hook to check whether a client is logged in and if not, redirect them to the login page. the above should work - assuming that the users can't just go to the register page to create an account. 0 Quote Link to comment Share on other sites More sharing options...
Fringe Posted February 4, 2021 Author Share Posted February 4, 2021 Hi brian! Thank you for the responce. I did the whole high pricing but it just increased tickets from people wondering why the cost was so high when it was supposed to be a discounted feature, lol... I can understand that so thats why I looked for a alternative option of making them only visable to customers with active services (had a module made) but the cart URL bypasses this so I was looking for a way to stop that. The link you gave to the 'Disallow reg' post is perfect, it helps me a great deal. Cheers and stay safe 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.