Getting product information with the email

User-selected product information can be sent through the Contact Form 7.

The product ID, URL, title, quantity, SKU, variations, price, etc. can be added automatically in the popup form.

You have to add our shortcode to Contact Form 7 for this. Here is a list of the available shortcodes.

  1. ID: [gqb_product_id]
  2. URL: [gqb_product_url]
  3. Title: [gqb_product_title]
  4. SKU: [gqb_product_sku]
  5. Price: [gqb_product_price]
  6. Status: [gqb_product_status]
  7. Type: [gqb_product_type]
  8. Product Quantity: [gqb_product_qty]
  9. Stock Status: [gqb_product_stock_status]
  10. Stock Quantity: [gqb_product_stock_quantity]
  11. Product Variations: [gqb_product_variations]
  12. Product Variations Value Only: [gqb_product_variations_value_only]
  13. Product Variation SKU: [gqb_product_variation_sku]
  14. Product Description: [gqb_product_description]
  15. Product Short Description: [gqb_product_short_description]
  • Step 1: Go to the CF7 form that you are showing on the Quote popup.
  • Step 2: Add the shortcode to both the form and mail body. And Save the form.
Adding the shortcodes to the CF7 form body

Want to show this information in the pop-up form?

By default, these pieces of information are hidden in the form. It will work in the background and send with the email. But if you want to show this information in the popup form, you can enable it in the plugin settings. Go to this plugin settings page > WooCommerce settings. Scroll to the bottom. Here you will see this option.

Adding the shortcodes to the CF7 mail body
Here is the result in the email

Showing Customer Selected Product Variations

Sending custom meta in the form

You may need to send a custom product meta through the contact form. You can add this PHP code with your custom meta key in such cases. For example, here, our meta key is “_model_number“.

And we need to add this tag to the contact form 7 form and mail “gqb_product_model_number“.

add_action( 'wpcf7_init', function(){
 wpcf7_add_form_tag( 'gqb_product_model_number', function( $tag ){
  if( isset( $_POST['wpb_post_id'] ) ){
      $id = sanitize_text_field( $_POST['wpb_post_id'] );
         return '<input class="gqb_hidden_field gqb_product_model_number" type="text" name="gqb_product_model_number" value="'.esc_attr( get_post_meta( $id, '_model_number', true ) ).'">';
     }
 } );
} );
Was this article helpful to you? No Yes

How can we help?