Jump to content

Autofill Custom Agreements on Checkout Page


Recommended Posts

Hello All,

There are some laws like GDPR here in Turkey and we need to auto create and auto fill some agreements on checkout of an order. Can we achieve this? Example Below

Service Provider Information
Seller Name : ISP Name (fixed data)
Seller Address    : ISP Address (fixed data)  
Seller Phone    : ISP Phone (fixed data)    
Seller Fax    :    ISP Fax (fixed data)
Seller  e-Mail    : ISP Mail (fixed data)

Customer Information
Customer Name    :    Need to autofill with Client Information or Contact Information that client selected on checkout page
Customer Address    :    Need to autofill with Client Information or Contact Information that client selected on checkout page
Customer Phone    :    Need to autofill with Client Information or Contact Information that client selected on checkout page and also need to anonymize
e-Mail/UserName    :    Need to autofill with Client Information or Contact Information that client selected on checkout page and also need to anonymize

Billing Information
Name/Surname/Company Name    :    Need to autofill with Client Information or Contact Information that client selected on checkout page
Tax Office and Tax Number    :    Need to autofill with custom text area from Client Information or Contact Information that client selected on checkout page and also need to anonymize
Customer Adress    :    Need to autofill with Client Information or Contact Information that client selected on checkout page
Customer Phone    :    Need to autofill with Client Information or Contact Information that client selected on checkout page and also need to anonymize
e-Mail/UserName    :    Need to autofill with Client Information or Contact Information that client selected on checkout page and also need to anonymize

 

CONTRACTUAL SERVICE AND PRODUCT INFORMATION
The main features of the Product and Service are available on the Website. The sales price of the product and service subject to the contract, including all taxes, is shown in the table below.

If the campaign is organized by the PROVIDER, you can review the basic features of the relevant Service during the campaign. The prices listed and announced on the Website are the selling price. Advertised prices and promises are valid until updated and changed. Prices announced for a period of time are valid until the end of the specified period.

 

Product Name Need to autofill from cart - if there are more than one products need to be rows

Quantity Need to autofill from cart - if there are more than one products need to be rows

Unit Price Need to autofill from cart - if there are more than one products need to be rows

Total (with TAX) : Need to autofill from cart - if there are more than one products need to be rows

 

*** If the product will be shipped, the shipping fee, which is the shipping cost, will be paid by the Client.

Shipping Address    :    Need to autofill with Client Information or Contact Information that client selected on checkout page
Shipped To    :    Need to autofill with Client Information or Contact Information that client selected on checkout page
Billing Address    :    Need to autofill with Client Information or Contact Information that client selected on checkout page
Order Date    :    Need to autofill with Checkout Date
Delivery Method    :     (fixed data)

 

Any Help Appreciated

Link to comment
Share on other sites

  • 8 months later...
  • WHMCS Technical Analyst

Hi @Safir Hosting,

Assuming that you are wanting to send this out automatically for each order (after successful payment), your best option would be to use the Other Product/Service Welcome Email template, as you have suggested.

You can read more about Email Templates here:
https://docs.whmcs.com/Email_Templates

All of the merge fields that you require are available. You can see a full list of the available merge fields at the bottom of the page when editing any email templates.

If you need to send this email under separate cover, this can be done by making use of the AcceptOrder hook (triggers your code when an order is accepted), and the SendEmail API endpoint. You would also need to create a new email template specifically for this purpsoe, which can be done via System Settings > Email Templates.

Implementing this is not something that our team can help you with, as it would be considered a third-party customisation, however the workflow would work like this:

  1. Customer places order
  2. Order is accepted (either automatically or manually by an admin)
  3. AcceptOrder hook is fired, sending a SendEmail request via the internal API
  4. Customer receives custom email notification

I'm sure that all the brilliant people in the Developer Corner would be happy to help you should you get stuck!
https://whmcs.community/forum/41-developer-corner/

Hope this helps 🙂 

Link to comment
Share on other sites

  • 2 months later...

Hello, we tried something and seems not worked. Can you help me,

 

<?php
add_hook('OrderPaid', 1, function($vars) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.safirhosting.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'SendEmail',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'ApiUserName',
            'password' => 'ApiPassword',
            '//example1' => 'example',
            'messagename' => 'Mesafeli Satış Sözleşmesi',
            'id' => '1',
            '//example2' => 'example',
            'customtype' => 'product',
            '//customsubject' => 'Mesafeli Satış Sözleşmesi',
            '//custommessage' => '<p>Thank you for choosing us</p><p>Your custom is appreciated</p><p>{$custommerge}<br />{$custommerge2}</p>',
            '//customvars' => base64_encode(serialize(array("custommerge"=>$populatedvar1, "custommerge2"=>$populatedvar2))),
            'responsetype' => 'json',
        )
    )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
});

Link to comment
Share on other sites

I Have done this with perfection by Pete Murphy. Here is the solution that need extra help, I think we can send unlimited information mails with this but be careful on email template group that used, not auto filling some areas.

<?php
add_hook('AcceptOrder', 1, function($vars) {

    $command = 'SendEmail';
    $postData = array(
        'messagename' => 'E-Mail Template Name Here',
        'id' => '1',
    );

    $results = localAPI($command, $postData);

});

 

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