Jump to content

Disable renewal option if invoice due


dotnetrix

Recommended Posts

So we've been seeing this issue a lot the last few months.

 

Scenario: Client signs up today for domain $10 and annual hosting $25, total being $35.

 

Next year he gets a "Domain Renewal" reminder that he must renew his domain.

 

Client logs into WHMCS client area then from Cart renew the domain name at $10.

 

The system already generated an invoice for recurring $35.

 

The client is upset and says he already paid his service, we have to explain that there is another invoice for the hosting as well.

 

Ideally I though about a hook that checks if an invoice is on the system for the domain in question, then disables the ability to renew that specific domain.

 

The problem is however that WHMCS does not have a hook point for Cart -> DomainRenewals

 

Any ideas would be much appreciated.

Link to comment
Share on other sites

two thoughts occur to me with this - and neither involve hooking!

 

1. alter the Upcoming Domain Renewal email template and remove/alter the part about renewing the domain now...

 

To ensure the domain does not expire, you should renew it now. You can do this from the domains management section of our client area here: {$whmcs_link}

just treat the email for what it is, a reminder to the client that a domain renewal is coming soon and tell them they'll receive an invoice for it when it is.

 

2. disable the "Enable Renewal Orders" checkbox in setup -> general settings -> domains

 

https://docs.whmcs.com/Domains_Tab#Enable_Renewal_Orders

 

When enabled clients will see domain renewal options in the client area and a renewal category in the shopping cart allowing for them to renew domains at any time.

When unticked clients will only be able to renew domains when the renewal invoice is automatically generated.

as you have found, it can cause all sorts of hassle if clients renew the domains directly without reference to invoices... it's simpler to not allow them to do it.

 

with regards to a hook solution, I would guess you'd be looking at ClientAreaPageDomains, but you could potentially do something simpler with one line of Smarty in clientareadomains.tpl...

 

<button type="button" class="btn btn-primary btn-sm" id="renewButton{$renewal.id}" onclick="addRenewalToCart({$renewal.id}, this)">

to...

<button type="button" class="btn btn-primary btn-sm {if $renewal.daysUntilExpiry lte '14'}disabled{/if}" id="renewButton{$renewal.id}" onclick="addRenewalToCart({$renewal.id}, this)">

that would disable the add to cart button if the expiry date is within 14* days of today (* change to your invoice generation or domain generation values if different), and thus should have already generated an invoice.

 

k2zns5z.png

I suppose from a hook point of view, you'd just need to alter the $renewals array for any domains that have been previously invoiced... but frankly, that sounds like a lot of unnecessary work to me. :)

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