Reputation: 45
I have added extra field in woocommerce billing checkout fields. It is working perfectly at front end. I want to display and edit this field at admin side in billing address. It is also working. but my problem is I want to display this field according to order total.
add_filter('woocommerce_admin_billing_fields',array($this, 'wcfe_admin_billing_fields'), 10);
function wcfe_admin_billing_fields($fields) {
global $order;
// I am not getting $order global here
print_r($order);
// my conditions based on order total
return $fields;
}
Upvotes: 2
Views: 878
Reputation: 65264
I think the global $order;
is not available in that moment the function is called... try something like this,
global $post;
$order = wc_get_order( $post->ID );
Upvotes: 4