Skip to content

Instantly share code, notes, and snippets.

@kreamweb
Created January 31, 2018 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kreamweb/d39220650230ab76e21c5d3fd01d2863 to your computer and use it in GitHub Desktop.
Save kreamweb/d39220650230ab76e21c5d3fd01d2863 to your computer and use it in GitHub Desktop.
<?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'] );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment