Jump to content

whmcs tax rule hide from guest users


Basheer

Recommended Posts

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 ?

iva 21.PNG

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

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';

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated