I am having some really hard times trying to make it work. I've had an idea in back of my head to:
be able to assign single user to a coupon code through an extra field in general coupon tab, which is listing unassigned users to coupon codes
I dont want to use third party extensions, custom-fields, etc. I was hoping I'll be able to do it through meta data but I failed. Not sure how to get it done properly.
add two extra columns on orders page and display both coupon code and user assigned to it.
After some time reading docs and xDebugging in phpstorm I have also failed to get it done.
function order_sellers_and_coupons_columns_values($column) { global $post, $the_order; if ($column == 'order_coupon_code') { $coupons = $the_order->get_used_coupons(); // not sure how to get coupon object by the coupon code echo (count($coupons)) ? $coupons[0] : ''; } } // even though I see the order objects have an items and coupon lines property, // which is an object, i can't get access to it $the_order->items["coupon_lines"]
I am not asking for ready-to-go solution, but to show me the way how to get it done.
Thanks in advance for any kind of help.