WooCommerce Code Correction

Ukończone Opublikowano 6 lat temu Płatność przy odbiorze
Ukończone Płatność przy odbiorze

I have defined two custom fields for my Woocommerce orders using WooCommerce Admin Custom Order Fields extension to create these.

When I manually create an order (/wp-admin/[login to view URL]), I can see those fields and I can successfully add data and save the order.

I have chosen "Show in my Order/Emails" in attributes of WooCommerce Admin Custom Order Fields extension and these fields are appearing in view order page of each orders at front end.

I would, however, also like to have these fields appear as columns in order detail page at /orders/ endpoint where tabular summary of all orders is shown.

Documentation of this extension "WooCommerce Admin Custom Order Fields" tells me that I can use something like get_post_meta($post_id, '_wc_acof_2') with 2 being the ID of that custom field. Have used several ways to achieve result, however, with no luck.

Here is the code I tried in [login to view URL]:

add_action( 'woocommerce_order_details_after_order_table', 'admin_custom_order_field', 10, 1 );

function admin_custom_order_field($order){

echo '<p><strong>'.__('Candidate Name').':</strong> ' . get_post_meta( $order->id, '_wc_acof_1', true ). '</p>';

echo '<p><strong>'.__('Case Due Date').':</strong> ' . get_post_meta( $order->id, '_wc_acof_2', true ). '</p>';

}

WooCommerce WordPress

Numer ID Projektu: #15891040

O projekcie

6 ofert Zdalny projekt Aktywny 6 lat temu

Przyznany użytkownikowi:

phpdevelopers020

Greetings! My name is Amit Kumar and I am an expert in web development. I believe my skills are good enough to match your project. I have a good grasp of working with core php, wordpress and framework Relevant Skills Więcej

₹950 INR w ciągu 0 dni
(10 ocen)
3.2

6 freelancerów złożyło ofertę za ₹3778 w tym projekcie

oliviainfotech

Hi greetings of the day I am a Experienced PHP Developer based out in Chennai,India. My experience revolves around development of web and mobile applications,Ecommerce websites. Relevant Skills and Experience I believ Więcej

₹2050 INR w ciągu 1 dnia
(9 Oceny)
3.8
patidarkavita489

A proposal has not yet been provided

₹1100 INR w ciągu 5 dni
(3 Oceny)
2.3
ruchimaniar07

Hello I am Ruchi Maniar wordpress developer since 2.5+ years. I will manage your problem after see the actual code. I may conflict with your other plugins. I have enough experience to solve this problem easily. Więcej

₹1250 INR w ciągu 1 dnia
(3 Oceny)
1.7
beingidea

A proposal has not yet been provided

₹650 INR w ciągu 1 dnia
(1 Ocena)
0.0