Jump to content

Accept Quote without Logging In


Kian

Recommended Posts

When you send a quote, WHMCS forces customers to login in order to accept it. This hook allows them to accept without the need to login. Every time the Quote Delivery with PDF mail is sent, the hook overrides {$quote_link} with a new link that contains an hash that ensures the authenticity of the request. This way only the recipient can accept the quote.

When the visitor clicks the link, the quote is automatically accepted and he/she sees the following modal on screen.

quote-accepted.png.c13165dd2d820616f4de5626112362b1.png

Get the Code »

Edited by Kian
Link to comment
Share on other sites

  • 6 years later...

Hello. 

Is there a way to stop the invoice auto creation when accepting the quote?

If the quote is accepted from the whmcs pages, the system does not auto create the invoice.

Thank you

Link to comment
Share on other sites

  • 2 months later...

Hi, I'll take the unanswered question. First, the stock behaviour.

 

In stock WHMCS, when a client clicks Accept on a quote, the quote is only marked Accepted. No invoice is created. Converting to an invoice is a separate admin step (Convert to Invoice on the quote). That matches what you're seeing from the normal WHMCS pages.

 

So if the hash-link route creates an invoice, something other than stock behaviour is doing it. There are three likely sources:

- Kian's script itself

- another hook in your hooks folder

- an addon module. For example, ModulesGarden's Quotes Automation can auto-create invoices on accept, so check whether you have anything like it installed.

 

How to find what's creating it

1. Open the activity log and look at the entries around the time you tested an accept. You should see the quote being accepted and then the invoice being created, and the order and timing tell you a lot.

2. Search the script and your hooks folder for the following. Searching all of them also catches any hook that creates an invoice directly:

   - `AcceptQuote`

   - `ConvertQuote`

   - `CreateInvoice`

   - `localAPI`

   - invoice inserts

3. Check Addon Modules for anything quote-related.

4. On a staging copy, rename the script or hook file, repeat the accept, and see if the invoice still appears. Test this on staging, not live.

 

If the script calls the local API to accept the quote, check what that call does in your WHMCS version. It may not behave exactly like the client-area button.

 

To stop it

Remove or comment out the invoice-creation part in the script and leave only the accept step. If it's a module, look for an "auto create invoice on accept" setting. Then convert from admin when you're ready.

 

AcceptQuote hook caveats

- It receives `quoteid` and `invoiceid`, but `invoiceid` is only there if applicable. In the stock flow it will be empty, so don't assume it's populated.

- It runs after the accept has happened. It can notify or react, but it can't veto the accept. If you need a gate, do it before the accept call.

- If you create an invoice from inside the hook, check the quote doesn't already have one first. Otherwise a double click, or a module and a hook both firing, gives you duplicate invoices.

 

Since the hash link is unauthenticated, make sure the hash is long, random and ideally expiring. Also log the IP and time of each accept.

 

The original script is old, so test it on your current version before relying on it.

Link to comment
Share on other sites

×
×
  • 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