Hi Mouli90
Thanks a lot. Glad you find this Plugin useful.
That’s true. Only the default fields are getting saved.
I put this on the feature List of Version 1.2.
The release is expected till the end of the year.
Best,
Daniel
Hi Mouli90
Version 1.2 is out now!
Custom Fields are getting saved in the usermeta as well.
It will take the ID of the field and prefix it with “shipping_” or “billing_”.
Give it a try and let me know.
Best, Daniel
Hi Daniel,
sorry for a bit of a delay in answering. And thanks for such quick response regarding the custom fields.
I created a new custom field having “billing_” prefix but it did not seem to work. Basically, I have created a new order and filled in a customer billing data, saved it and right after created a new order in which I wanted to retrieve the previous customer with its data through the drop-down field ( https://prnt.sc/1vz38d8 ). All fields got populated except of the custom field I had created.
For creating the custom field I used the exact function definition as shown in my very first message so if there is something I am doing wrong, please let me know.
Many thanks
Jan
Hi Jan
Thanks for your feedback. I did some testing.
Unfortunately, I could not reproduce the issue.
The Code I’m using in this example:
add_filter("woocommerce_admin_billing_fields", "order_admin_custom_fields");
add_filter("woocommerce_admin_shipping_fields", "order_admin_custom_fields");
function order_admin_custom_fields($fields)
{
global $the_order;
$fields["dans_art_custom_field"] = array(
"label" => __("This is a Custom Field", "woocommerce") ,
"show" => true,
);
return $fields;
}
This adds both, a billing and a shipping field.
Here you can see the Fields before creation.
https://prnt.sc/1w05zx4
In a new order, when the user is selected, the billing and shipping fields are getting filled out automatically.
https://prnt.sc/1w06293
And this is how it looks in the Database (wp_usermeta)
https://prnt.sc/1w061cp
Can you share with me, what kind of data ends up in the database regarding the custom field?
Best, Daniel
Hi Daniel,
Thank you for the example you sent. I discovered that the issue I had was in the ID that I named already with the prefix “billing_” e.g. “$fields[“billing_custom”] … “. After removing the prefix from ID everything worked smoothly :).
Thank you for this additional functionality that made the plugin much more flexible.
Have a great day!
Jan
Hi Jan
Thanks for your feedback. Good to hear 🙂
Have a great day!
Daniel
-
This reply was modified 10 months, 1 week ago by
dansart.