Developer hooks
Add these to your theme's functions.php or a small plugin.
Buttons and messages
| Hook | Type | Arguments | Use |
|---|---|---|---|
wpheka_rfq_display_for_product_type | filter | string[] $types | Product types that get the button on shop and category pages (default simple, subscription, external) |
wpheka_rfq_product_added_to_list_message | filter | string $message | "Product added to quote list." |
wpheka_rfq_product_already_in_list_message | filter | string $message | "Product already in the quote list." |
wpheka_rfq_product_added_view_browse_list | filter | string $text | The "Browse the list" link text |
wpheka_rfq_product_error_message | filter | string $message | The message when a product can't be added |
wpheka_request_page_url | filter | string $url | The quote list page URL |
The quote list page
| Hook | Type | Arguments | Use |
|---|---|---|---|
wpheka_rfq_content_start / wpheka_rfq_content_end | action | none | Start and end of the shortcode's output |
wpheka_check_quote_items | action | none | Before the list is shown |
wpheka_before_rfq_list / wpheka_after_rfq_list | action | none | Before and after the list form. The request form is printed on wpheka_after_rfq_list. |
wpheka_before_rfq_list_table / wpheka_after_rfq_list_table | action | none | Before and after the table |
wpheka_before_rfq_list_contents / wpheka_after_rfq_list_contents | action | none | First and last rows of the table |
wpheka_rfq_list_contents | action | none | After the product rows |
wpheka_rfq_actions | action | none | Next to the Update list button |
wpheka_after_rfq_item_name | action | array $item, string $key | After a product's name |
wpheka_cart_is_empty | action | none | On the empty quote list |
wpheka_rfq_item_product | filter | WC_Product $product, array $item, string $key | The product shown for a row (also in the email) |
wpheka_rfq_item_product_id | filter | int $id, array $item, string $key | The product ID of a row (also in the email) |
wpheka_rfq_item_visible | filter | bool $visible, array $item, string $key | Hide a row |
wpheka_rfq_item_class | filter | string $class, array $item, string $key | CSS class of a row |
wpheka_rfq_item_permalink | filter | string $url, array $item, string $key | Product link |
wpheka_rfq_item_thumbnail | filter | string $html, array $item, string $key | Product image |
wpheka_rfq_item_name | filter | string $html, array $item, string $key | Product name |
wpheka_rfq_item_price | filter | string $html, array $item, string $key | Price cell |
wpheka_rfq_item_quantity | filter | string $html, string $key, array $item | Quantity cell |
wpheka_rfq_item_subtotal | filter | string $html, array $item, string $key | Subtotal cell |
wpheka_rfq_item_remove_link | filter | string $html, string $key | The remove (×) link |
wpheka_rfq_item_backorder_notification | filter | string $html, int $product_id | "Available on backorder" |
The request form
| Hook | Type | Arguments | Use |
|---|---|---|---|
wpheka_before_rfq_form_start / wpheka_after_rfq_form_end | action | none | Before and after the form |
wpheka_rfq_form_start | action | none | First thing inside the form |
wpheka_rfq_form | action | none | After the message field |
wpheka_rfq_form_end | action | none | Last thing inside the form |
The quote email
| Hook | Type | Arguments | Use |
|---|---|---|---|
wpheka_rfq_email_items_heading | filter | string $heading, WC_Email $email | The "Quote summary" heading (HTML email) |
wpheka_rfq_email_before_items_table | action | array $items, WC_Email $email | Before the products |
wpheka_rfq_email_after_items_table | action | array $items, WC_Email $email | After the products |
The email templates are emails/request-for-quote-mail-template.php and emails/plain/request-for-quote-mail-template.php. Copy one to yourtheme/woocommerce/ to change it.
Setup, sessions and caching
| Hook | Type | Arguments | Use |
|---|---|---|---|
wpheka_rfq_loaded | action | none | The plugin has loaded |
wpheka_rfq_init | action | none | The plugin has initialised |
wpheka_rfq_installed | action | none | After activation set things up |
wpheka_rfq_create_pages | filter | array $pages | Pages created on activation |
wpheka_rfq_create_page_id | filter | int $id, string $slug, string $content | Use an existing page instead of creating one |
wpheka_rfq_shortcode_tag | filter | string $tag | The shortcode put on the created page |
wpheka_rfq_session_handler | filter | string $class | Session handler class |
wpheka_rfq_cookie | filter | string $name | Session cookie name |
wpheka_rfq_session_expiring | filter | int $seconds | When a session starts to expire (default 47 hours) |
wpheka_rfq_session_expiration | filter | int $seconds | When a session expires (default 48 hours) |
wpheka_rfq_prevent_page_caching | filter | bool $prevent | Whether the current page must not be cached (default: on the quote list page) |
wpheka_rfq_purge_caches | action | none | After saving settings cleared the known page caches. Clear your own cache here. |
Examples
Show the button on shop and category pages for simple products only:
add_filter( 'wpheka_rfq_display_for_product_type', function () {
return array( 'simple' );
} );
Change the message after adding a product:
add_filter( 'wpheka_rfq_product_added_to_list_message', function () {
return 'Added. Send your list when you are ready.';
} );