Plugin Contributor
Sark
(@sarkware)
Basically what you are asking is the ability to add custom order line item meta after the order is placed right.?
That is kind of possible. but I have one question, an order can have more than one products right.? in that case how will be the admin fields will be injected.
Each order line item will get there own set of custom fields (If it is assigned one).
thank you for your reply
when using (WooCommerce Admin Custom Order Fields) the Field Appear in every orders for all products
see the attached images
https://drive.google.com/drive/folders/1etd5HuzznGq6b-dexFaxibmyIgs4YHa_
but I need it to be showing for only specific product
and when i found your plugin make the abilty to choose wich product to add the field to .
But it dosn’t show the Field at “WooCommerce -> Orders -> Edit order”
so I Asked.
I hope i described what i need
Plugin Contributor
Sark
(@sarkware)
Ok, got it, I will add that feature in our next release, propably within a week.
Thank you for your fast reply
waiting for the new release.
Hi
already updated to WC Fields Factory Version 4.0.4
but i did not find how to add admin field to “order edit” after placing order
so please help to make it
Plugin Contributor
Sark
(@sarkware)
@hasanmajhali Not in this release, since I had release some priority bug fixes, Order Fields coming within this week (max within Next Monday).
Hi Sark
I Hope you are doing well
this is just a reminder
Thank you for your Time
Plugin Contributor
Sark
(@sarkware)
Hi, this option is available with Version 4.0.7, pls update and lewt me know.
Hi Sark,
thank you for adding admin field to Order view
as I tested it Only appear on admin backend Edit order page but not appear on order email or on Customer my-account Page -> Orders -> Order details,
Please guide me if I missing any thing
Plugin Contributor
Sark
(@sarkware)
Ok there is one mistake.
Pls edit the the following line from /wp-content/plugins/wc-fields-factory/includes/wcff_admin_fields.php
LN : 278
Replace that line with the following
"value" => get_post_meta($_order->get_id(), $key, true)
Hi sark,
thank you for your reply
for your notice I updated WC Fields Factory to Version 4.0.8
and as you said I set Send to Customer to “Yes”
as shown
https://drive.google.com/file/d/1yqx-Om9CCaIhywDIol8obFd95zxjHNri/view?usp=sharing
and also changed Line 278
https://drive.google.com/file/d/1SzSY7TkMsMPuueyDbJRP3Y55q0W242K2/view?usp=sharing
and when I Place New Test order the Admin field not appear on order Email or on Customer my-account Page -> Orders -> Order details,
https://drive.google.com/file/d/17UUHtyLrhZewqD5Aybwaohnwf8IGAzAK/view?usp=sharing
it Only appear on admin backend Edit order page
https://drive.google.com/file/d/1s3uXh8Z9CvVmO5dYjTwNvDWewrWglFF4/view?usp=sharing
waiting for your your instructions.
Plugin Contributor
Sark
(@sarkware)
In the wcfff_admin_fields.php
pls replace the following functions.
public function custom_order_fields_on_order_email($_fields = array(), $_sent_to_admin, $_order) {
/* Update the location property manually */
$this->location = "admin_head-post.php";
$custom_fields = $this->prepare_field_for_order_view($_order->get_id(), true);
foreach( $custom_fields as $group ) {
if (count($group["fields"]) > 0) {
foreach ($group["fields"] as $field) {
if (is_array($field) && isset($field["label"]) && isset($field["key"])) {
$send = isset($field["email_meta"]) ? $field["email_meta"] : "yes";
if ($send == "yes") {
$_fields[] = array(
"label" => $field["label"],
"value" => get_post_meta($_order->get_id(), $field["key"], true)
);
}
}
}
}
}
return $_fields;
}
private function prepare_field_for_order_view($_post_id = 0, $_return = false) {
$target_products = array();
if ($_post_id != 0) {
$post_id = $_post_id;
} else {
global $post;
$post_id = $post->ID;
}
/* Check for shop order screen - to inject fields for order view */
if ($post_id > 0) {
$order = wc_get_order($post_id);
if ($order) {
foreach ($order->get_items() as $key => $item) {
if (isset($item["product_id"])) {
$target_products[] = $item["product_id"];
}
if (isset($item["variation_id"]) && !empty($item["variation_id"]) && $item["variation_id"] != 0) {
$target_products[] = $item["variation_id"];
}
}
}
/* Now get the fields */
$groups = array();
foreach($target_products as $pid) {
$gs = wcff()->dao->load_fields_groups_for_product($pid, 'wccaf', "admin", $this->location);
$gs = $this->remove_duplicate_groups($groups, $gs);
$groups = array_merge($groups, $gs);
}
if ($_return) {
return $groups;
}
$this->admin_fields_groups = $groups;
}
}
Plugin Contributor
Sark
(@sarkware)
@hasanmajhali the fix is available with the latest release, please update the plugin.
Hi sark,
thank you for your reply
Great Now WC Fields Factory Version 4.0.9 show the admin field on order Email
Please make it appear on Customer my-account Page -> Orders -> Order details,
Plugin Contributor
Sark
(@sarkware)
Sure, will include it in the next release.
Also your rating & review would be appriciated.