kreamweb
1/31/2018 - 9:19 AM

[Request a quote] Additional Contact Form 7

<?php

if ( class_exists( 'YITH_YWRAQ_Order_Request' ) ) {
 add_action( 'ywraq_add_order_meta', 'ywraq_add_order_meta', 10, 2 );

 function ywraq_add_order_meta( $order_id, $raq ) {
 if ( ! isset( $raq['other_email_fields'] ) ) {
 return;
      }

 $other_fields = $raq['other_email_fields'];  //here you can find the custom field that you have set on CF7
 
 //your-billing_phone is the name of your custom input field
 if ( isset( $other_fields['your-billing_phone']) ) {
 update_post_meta( $order_id, '_billing_phone', $other_fields['your-billing_phone'] );
      }
 
 if ( isset( $raq['your-billing_address_1'] ) ) {
 update_post_meta( $order_id, '_billing_address_1', $other_fields['your-billing_address_1'] );
      }
 
 if ( isset( $raq['your-billing_address_2'] ) ) {
 update_post_meta( $order_id, '_billing_address_2', $other_fields['your-billing_address_2'] );
      }

   }

}