Getting product information with the email (CF7)

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

The product ID, URL, title, quantity, SKU, variations, price, and all other details can be added automatically in the pop-up form. We have added CF7 custom special mail tags for this.

Please go to the CF7 form edit page, and you will find a button on top called “Quote Product Data”, When you click on this button, a popup with all the available product data options will show up in a dropdown. Just select which product data you want to have, and hit the insert button.

A new custom shortcode will be added for each of the product data shortcodes in the form. Don’t forget to add the mail shortcodes in the CF7 mail tab to show this data in your email.

If you want to hide these fields, please set them hidden in the quote plugin settings.

Please check the screenshots to get a detailed idea about it.

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 1 Yes

How can we help?