Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add_member_field( $meta_fields ) {
- $meta_fields['member_bought'] = array( 'label' => 'Member Bought', 'group' => 'woocommerce' );
- return $meta_fields;
- }
- add_filter( 'wpf_meta_fields', 'add_member_field' );
- function get_member_data( $order_data, $order ) {
- foreach ( $order->get_items() as $item ) {
- $product_id = $item->get_product_id();
- $product_terms = get_the_terms( $product_id, 'product_cat' );
- foreach ( $product_terms as $term ) {
- if ( $term->slug == 'membership' ) {
- $order_data['member_bought'] = 'YES';
- break 2;
- }
- }
- }
- return $order_data;
- }
- add_filter( 'wpf_woocommerce_customer_data', 'get_member_data', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement