Basheer Posted August 9, 2017 Share Posted August 9, 2017 Hi, I have a situation. In my whmcs we have created a tax rule named IVA, it applicable only for particular countries. Some one visit my website and try to order service without register and click buy button it leads to cart page. Initial screen is showing IVA with 0 value, but when we provide address and if it is not in that countries, it will remove IVA. My requirement is to hide tax rule for guest users if he not enter any country details. Is it possible ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 9, 2017 Share Posted August 9, 2017 wrap that tax line in the template with an {if $loggedin} {/if} - then users who are not logged in, wouldn't see it. 0 Quote Link to comment Share on other sites More sharing options...
Basheer Posted August 9, 2017 Author Share Posted August 9, 2017 thank you brain.. One more thing , we didn't give tax rule for that particular product , we take out apply taxes(Tick this box to charge tax for this product) from product manage tab in admin panel. then why it display tax rule here ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 9, 2017 Share Posted August 9, 2017 it's difficult to say without seeing the settings - perhaps it was enabled at some point, and it's still cached in the browser... 0 Quote Link to comment Share on other sites More sharing options...
Basheer Posted August 9, 2017 Author Share Posted August 9, 2017 wrap that tax line in the template with an {if $loggedin} {/if} - then users who are not logged in, wouldn't see it. we can hide tax rule display for not logged users using this condition , but i scared total amount should be +taxable. [if i tick apply tax rule for this product in product manage tab in admin side] 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 9, 2017 Share Posted August 9, 2017 it occurs to me that WHMCS will show this IVA tax to non logged-in clients because, I assume, this tax applies to your default country in general settings -> localisation... e.g if this tax applies to India, and India is your default country, WHMCS assumes the user is from India until told otherwise (e.g until they register/login)... if your default country is Zimbabwe, and the tax doesn't apply to that country, then it won't be shown in the cart to the user. so the quick solution, without the need for any coding, might be to change your default country to one this tax doesn't apply to. 0 Quote Link to comment Share on other sites More sharing options...
Basheer Posted August 10, 2017 Author Share Posted August 10, 2017 so the quick solution, without the need for any coding, might be to change your default country to one this tax doesn't apply to. , Anyway thanks Brain! 0 Quote Link to comment Share on other sites More sharing options...
Basheer Posted August 10, 2017 Author Share Posted August 10, 2017 Is there any option to change default country using ip location or something ... [,whmcs scripts] 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 10, 2017 Share Posted August 10, 2017 Is there any option to change default country using ip location or something ... [,whmcs scripts] I don't think there's a Smarty variable the cart uses to determine default country, it's likely just pulled from the tblconfiguration database table value... which you don't really want to be manipulating on a per-product basis. there are WHMCS GeoIP solutions (Marketplace will list some of them), but I don't think any will change the default country... but frankly, for reasons too tedious to mention, i've been awake for 42 hours now - so i'm not even sure of my own name, let alone the intricacies of WHMCS default country. 0 Quote Link to comment Share on other sites More sharing options...
Basheer Posted August 11, 2017 Author Share Posted August 11, 2017 ... but frankly, for reasons too tedious to mention, i've been awake for 42 hours now - so i'm not even sure of my own name, let alone the intricacies of WHMCS default country. cool.......... 0 Quote Link to comment Share on other sites More sharing options...
Basheer Posted August 25, 2017 Author Share Posted August 25, 2017 Hi, I just re-open this thread for checking is any other option ? My requirement is For not loged users system will not apply any tax rule on product ? 0 Quote Link to comment Share on other sites More sharing options...
Basheer Posted August 28, 2017 Author Share Posted August 28, 2017 I think i have got a solution... If not loged user i just change the country that not have any tax. add_hook('CartTotalAdjustment', 1, function($vars) { session_start(); $client = Menu::context('client'); if(is_null($client)) $_SESSION['cart']['user']['country']='IN'; 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.