Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add_product_name_field( $meta_fields ) {
- $meta_fields['product_name'] = array( 'label' => 'Last Product Purchased', 'group' => 'woocommerce' );
- return $meta_fields;
- }
- add_filter( 'wpf_meta_fields', 'add_product_name_field' );
- function get_product_data( $order_data, $order ) {
- foreach ( $order->get_items() as $item ) {
- $product_id = $item->get_product_id();
- $order_data['product_name'] = get_the_title( $product_id );
- }
- return $order_data;
- }
- add_filter( 'wpf_woocommerce_customer_data', 'get_product_data', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement