Product FAQs has no settings screen, so changes to the tab and the FAQ list are made with filters in a small custom plugin or your theme’s functions.php. For adding FAQs to products, see Get started with Product FAQs.
Filters
wcpf_product_faqs_tab_title
Filters the product tab’s title. Default FAQs.
wcpf_product_faqs_tab_priority
Filters the tab’s position among the product tabs. Default 50, which puts it after WooCommerce’s Description (10), Additional information (20) and Reviews (30) tabs. Return a lower number to move it earlier.
wcpf_product_faqs_title
Filters the heading above the FAQs, in both the tab and the [wcpf_product_faqs] shortcode. Default FAQs.
wcpf_product_faqs_expanded_by_default
Return true to show every answer open when the page loads. Default false. Shoppers can still click a question to close its answer.
wcpf_product_faqs_disable_styling
Return true to stop the plugin’s stylesheet from loading, so you can style the FAQs with your own CSS. Default false. Without the stylesheet, answers aren’t hidden, so they start open, and clicking a question still closes and opens its answer.
wcpf_product_faqs_before
Filters text shown above the questions, below the heading. Default empty. The value is escaped as plain text, so HTML tags show as text rather than formatting.
wcpf_product_faqs_after
Filters text shown below the questions. Default empty. Escaped as plain text, like wcpf_product_faqs_before.
Recipes
Rename the tab and the heading
add_filter( 'wcpf_product_faqs_tab_title', function() {
return __( 'Questions', 'your-text-domain' );
} );
add_filter( 'wcpf_product_faqs_title', function() {
return __( 'Frequently asked questions', 'your-text-domain' );
} );
To change these labels without code, use a translation plugin; see changing text in a plugin.
Show the FAQs tab first
add_filter( 'wcpf_product_faqs_tab_priority', function() {
return 5;
} );
Open every answer by default
add_filter( 'wcpf_product_faqs_expanded_by_default', '__return_true' );
Add a line below the FAQs
add_filter( 'wcpf_product_faqs_after', function() {
return __( 'Still have a question? Contact us before you order.', 'your-text-domain' );
} );
Shortcode
[wcpf_product_faqs] outputs the FAQs of the product the page shows, with the heading from wcpf_product_faqs_title. It takes no attributes, and it outputs nothing on pages that aren’t product pages. The FAQ stylesheet loads only on single product pages.
CSS classes
For custom styling, the FAQs use this markup:
| Class | Element |
|---|---|
wcpf-product-faqs | The wrapper around all FAQs |
wcpf-product-faqs-expanded | Added to the wrapper when wcpf_product_faqs_expanded_by_default returns true |
wcpf-product-faqs-faq | One question and its answer |
wcpf-product-faqs-faq-question | The question, which opens and closes the answer on click |
wcpf-product-faqs-faq-answer | The answer |
For where to add CSS, see how to add custom CSS to your site.
Keep learning
- Get started with Product FAQs (adding FAQs, the shortcode and CSV import)
- How to add custom CSS to your site (styling the FAQs)
- Changing text in a plugin (renaming labels without code)
