Can’t seem to get “Custom Field” with PHP

[ad_1]

Hi,

I’m currently trying to add some custom field data in the orderID, and with that I am tryin to retrieve a custom field that is on each product. Here is my code:

function change_woocommerce_order_number( $order_id, $order ) {
$prefix = get_post_meta($order_id, ‘wapf[field_63c915e67f273]’, true);
// You can use either one of $order->id (or) $order_id
// Both will work
return $prefix . $order->id;
}

I have tried many different variations in order to target the field, but can’t seem to get the information out. Hope you can help.

Thanks,

Dan

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer