Jump to content

Help with Action hook - customizing shopping cart


Recommended Posts

Hi;

 

I'm already using WHMCS built in free domains feature to offer free domain for a few different tld's.

So I'm trying to use action hooks to do the following:

 

- If payment term is "Annually", give the user free ".com.br" domain registration.

 

To accomplish that i have a few options:

 

a) Add a new product to the shopping cart which could be a discount (with a negative value) and at the end the user won't pay for the domain.

b) Change the domain registration price to $0 (not sure if it's even possible)

 

I can hook to the "PreCalculateCartTotals" actions and test the condition but unfortunatelly i don't know how to continue from there (I'm not a php guy).

 

function freebrDomain($vars) {
   foreach ($_SESSION['cart']['domains'] as $domain) {
       if (strstr($domain['domain'], ".com.br")) {            
           /* DO SOMETHING IN HERE */
       }        
   }
}

add_hook("PreCalculateCartTotals",1,"freebrDomain");

 

I already tried to hire WHMCS guys to do this for me but my ticket wasn't answer (i sent it a few days ago), so I'm hoping somebody out there can help me with that.

 

It also would cover the following possibilities:

 

1- Add discounts on change price for each .com.br domain included on a product with Annual payment.

2- Consider the user can go back and remove product or change payment terms so, has to be tested and adjusted every time to show the correct total.

 

Thanks in advance;

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