Skip to content

Instantly share code, notes, and snippets.

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 trueqap/43f996a976c8cef3f4be43d5a8fa95dd to your computer and use it in GitHub Desktop.
Save trueqap/43f996a976c8cef3f4be43d5a8fa95dd to your computer and use it in GitHub Desktop.
Line around 110
<?php
foreach ($billing_fields as $field_key => $field) {
if (! in_array($field_key, (array) $billing_all_fields, true)) {
continue;
}
$function_name = 'get_' . $field_key;
if ($order->get_meta('_' . $field_key)) {
$data = $order->get_meta('_' . $field_key);
} else {
$data = $order->$function_name();
}
woocommerce_form_field($field_key, $field, $data);
}
<?php
foreach ( $billing_fields as $field_key => $field ) {
if ( ! in_array( $field_key, (array) $billing_all_fields, true ) ) {
continue;
}
$function_name = 'get_' . $field_key;
$data = $order->$function_name();
woocommerce_form_field( $field_key, $field, $data );
}
<?php
foreach ($billing_fields_form as $billing_field_key => $billing_field) {
if (isset($_POST[ $billing_field_key ])) {
if ($order->get_meta('_' . $billing_field_key)) {
update_post_meta($order->ID, '_'. $billing_field_key, wp_unslash($_POST[ $billing_field_key ]));
} else {
call_user_func_array(array( $order, 'set_' . $billing_field_key ), array( sanitize_text_field(wp_unslash($_POST[ $billing_field_key ])) ));
}
}
}
@trueqap
Copy link
Author

trueqap commented Mar 31, 2022

set_ is missing ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment