add_action( 'woocommerce_account_dashboard', function() { // Settings $to_email = '[email protected]'; $button_color = '#333333'; $button_text = '#ffffff'; $button_label = 'Send'; $email_subject = 'Subject Line'; // Form Code $current_user = wp_get_current_user(); $from_email = isset( $current_user->user_email ) ? $current_user->user_email : ''; $args = implode( ',', [ '"customBackgroundButtonColor":"' . $button_color . '"', '"customTextButtonColor":"' . $button_text . '"', '"submitButtonClasses":"wp-block-button__link has-text-color has-background"', '"hasFormSettingsSet":"yes"', ] ); $content = sprintf( ' <!-- wp:jetpack/contact-form {"subject":"%s","to":"%s","submitButtonText":"%s"%s} --> <!-- wp:jetpack/field-email {"required":true,"defaultValue":"%s"} /--><br> <!-- wp:jetpack/field-textarea {"required":true} /--><br> <!-- /wp:jetpack/contact-form --> ', $email_subject, $to_email, $button_label, $args, $from_email ); // Render Block echo do_blocks( $content ); } );

Place a Gutenberg JetPack contact form anywhere
Adds the Gutenberg JetPack contact form to the My Account Dashboard screen, or wherever else you wish to hook it.