# "Ask a Question About This Product" Link

> Adds a link under the Add to Cart button that opens an email to your shop with the product name and link already filled in, an easy way to capture pre-sale questions.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, product-page, enquiries, contact
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-product-question-link/

## Code

```php
$wpide_question_email = 'hello@example.com'; // Address that receives questions.

add_action( 'woocommerce_after_add_to_cart_form', function () use ( $wpide_question_email ) {
    global $product;

    if ( ! $product instanceof WC_Product || ! is_email( $wpide_question_email ) ) {
        return;
    }

    $subject = rawurlencode( 'Question about ' . $product->get_name() );
    $body    = rawurlencode( "Hi,\n\nI have a question about " . $product->get_name() . ' (' . $product->get_permalink() . "):\n\n" );

    printf(
        '<p class="wpide-product-question"><a href="mailto:%1$s?subject=%2$s&body=%3$s">%4$s</a></p>',
        esc_attr( $wpide_question_email ),
        esc_attr( $subject ),
        esc_attr( $body ),
        esc_html( 'Have a question about this product?' )
    );
} );
```

## Notes

Set the address in $wpide_question_email; the visitor's own email app sends the message, so no form data passes through your site.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find ""Ask a Question About This Product" Link" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
