shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php

How to add PEP Custom Form field in Quote PDF

In this article, we will go through how to add the Custom Form field in Quote (Quotation) PDF.

Suppose, you have added the Phone field in PEP custom form as below:

Now, you want to add the customer’s phone number captured through the custom form in the generated Quote PDF. How to do that?

It involves a bit of the coding part. To do so, you need to override the template file product-enquiry-pro/templates/admin/pdf-quote/recipient-info.php. To override the template file, copy the template file product-enquiry-pro/templates/admin/pdf-quote/recipient-info.php to your_theme_or_child_theme/quoteup/admin/pdf-quote/recipient-info.php. Check out our detailed article about overriding the PEP template file.

After copying the file, replace the code in the file your_theme_or_child_theme/quoteup/admin/pdf-quote/recipient-info.php with the following code to add customer’s phone number captured through custom form in Quote PDF:

<?php
global $wpdb;
$enquiry_meta_tbl = getEnquiryMetaTable();
$phone_number     = $wpdb->get_var($wpdb->prepare("SELECT meta_value FROM $enquiry_meta_tbl WHERE enquiry_id = %d AND meta_key = 'Phone'", $enquiry_id));
?>

<div class="to-info">
    <div class="to-title">
        <?php _e('Quote For', QUOTEUP_TEXT_DOMAIN); ?>
    </div> <!-- .to-title ends here -->
    <div class="to-data">
        <?php
            echo esc_html($name) . "<br>";
            echo esc_html($mail) . "<br>";
            echo esc_html($phone_number) . "<br>";
        ?>
    </div> <!-- .to-data ends here -->
</div> <!-- .to-info ends here -->

To add other fields of the custom form, replace the Phone string in the following code with the label you have added in the custom form field:

$wpdb->get_var($wpdb->prepare("SELECT meta_value FROM $enquiry_meta_tbl WHERE enquiry_id = %d AND meta_key = 'Phone'", $enquiry_id));

For example, if you have added another field in the custom form or you have named your Phone field as Telephone, then replace the Phone string with Telephone as shown below:

$wpdb->get_var($wpdb->prepare("SELECT meta_value FROM $enquiry_meta_tbl WHERE enquiry_id = %d AND meta_key = 'Telephone'", $enquiry_id));
Updated on February 4, 2021
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php

Was this article helpful?

shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php

Related Articles