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.
- ID: [gqb_product_id]
- URL: [gqb_product_url]
- Title: [gqb_product_title]
- SKU: [gqb_product_sku]
- Price: [gqb_product_price]
- Status: [gqb_product_status]
- Type: [gqb_product_type]
- Product Quantity: [gqb_product_qty]
- Stock Status: [gqb_product_stock_status]
- Stock Quantity: [gqb_product_stock_quantity]
- Product Variations: [gqb_product_variations]
- Product Variations Value Only: [gqb_product_variations_value_only]
- Product Variation SKU: [gqb_product_variation_sku]
- Product Description: [gqb_product_description]
- 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.
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.
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 ) ).'">';
}
} );
} );