Skip to content

Hooks & Filters

LiteQuote provides hooks for developers who want to customize behavior without modifying the plugin core.

Filters

litequote_modal_data

Filter the data object passed to the JavaScript frontend via wp_localize_script.

php
add_filter( 'litequote_modal_data', function( $data ) {
    // Add custom data for the JS frontend
    $data['custom_field'] = 'value';
    return $data;
} );

Parameters:

  • $data (array) -- The litequoteData object containing ajaxUrl, nonce, i18n, whatsapp config

litequote_email_attachments

Add or modify email attachments (used by the PDF module).

php
add_filter( 'litequote_email_attachments', function( $attachments, $data ) {
    // Add a custom file to the email
    $attachments[] = '/path/to/custom-file.pdf';
    return $attachments;
}, 10, 2 );

Parameters:

  • $attachments (array) -- Array of file paths to attach
  • $data (array) -- Sanitized submission data

woocommerce_is_purchasable

LiteQuote hooks into this WooCommerce filter to make quote products non-purchasable.

php
// Force a specific product to always be purchasable (override LiteQuote)
add_filter( 'woocommerce_is_purchasable', function( $purchasable, $product ) {
    if ( $product->get_id() === 42 ) {
        return true;
    }
    return $purchasable;
}, 20, 2 ); // Priority 20 to run after LiteQuote (priority 10)

woocommerce_get_price_html

LiteQuote hooks into this to replace the price with the configured label.

Actions

WordPress AJAX

LiteQuote registers the AJAX action litequote_submit_quote for both logged-in and logged-out users:

php
// Run custom code after a quote is submitted
add_action( 'wp_ajax_nopriv_litequote_submit_quote', function() {
    // Your custom logic (runs before LiteQuote's handler at priority 10)
}, 5 );

WP-Cron

  • litequote_pdf_purge -- Runs daily to delete expired PDF archives

CSS Custom Properties

Override the button styling via CSS variables:

css
:root {
    --litequote-btn-bg: #e74c3c;
    --litequote-btn-color: #ffffff;
}

Or use the Custom CSS field in WooCommerce > LiteQuote > Advanced.

Key Classes

ClassFilePurpose
LiteQuote_Coreincludes/class-litequote-core.phpProduct detection, button/price replacement
LiteQuote_Formincludes/class-litequote-form.phpAJAX handler for submissions
LiteQuote_Emailincludes/class-litequote-email.phpEmail building and sending
LiteQuote_Securityincludes/class-litequote-security.phpNonce, honeypot, sanitization, rate limiting
LiteQuote_WhatsAppincludes/class-litequote-whatsapp.phpWhatsApp URL builder
LiteQuote_PDFincludes/class-litequote-pdf.phpPDF generation (FPDF)
LiteQuote_Settingsincludes/class-litequote-settings.phpOptions retrieval, defaults
LiteQuote_Adminadmin/class-litequote-admin.phpSettings page with tabs
LiteQuote_Quote_CPTincludes/class-litequote-quote-cpt.phpQuote CPT, dashboard, reply, CSV export

Product Meta

Meta KeyValueDescription
_litequote_enabledyes / noWhether the product is in quote mode

Plugin Options

All options use the prefix litequote_ and are stored with autoload = yes.

See Configuration for the full list.

Released under the GPL v2 License.