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 Easily Add a PEP Custom Form Field to a Quote PDF

In this guide, we’ll walk through the process of adding a custom form field, like a customer’s phone number, to the Quote (Quotation) PDF.

Step-by-Step Guide:

Step 1: Add a Custom Field (Example: Phone Number)
Let’s say you’ve added a “Phone” field in your PEP custom form.

Now, you want to display this phone number on the generated Quote PDF. Here’s how you can do that with some code adjustments.

Step 2: Overriding the Template File
To begin, you need to override the template file product-enquiry-pro/templates/admin/pdf-quote/recipient-info.php. Follow these steps:

  • Copy the file from:
    product-enquiry-pro/templates/admin/pdf-quote/recipient-info.php
  • Paste it into your theme or child theme directory:
    your_theme_or_child_theme/quoteup/admin/pdf-quote/recipient-info.php

For more details, you can refer to our overriding the PEP template file.

Step 3: Add Code to Display the Custom Field
After copying the file, replace the existing code with the snippet below to include the customer’s phone number in the 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>
    <div class="to-data">
        <?php
            echo esc_html($name) . "<br>";
            echo esc_html($mail) . "<br>";
            echo esc_html($phone_number) . "<br>";
        ?>
    </div>
</div>

Adding More Fields:

To add additional custom fields from your form, simply replace the word “Phone” in the code with the corresponding label of the field you’ve created:

$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 September 21, 2024
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