{"action":"created","issue":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/10098","labels_url":"https://api.github.com/repos/woothemes/woocommerce/issues/10098/labels{/name}","comments_url":"https://api.github.com/repos/woothemes/woocommerce/issues/10098/comments","events_url":"https://api.github.com/repos/woothemes/woocommerce/issues/10098/events","html_url":"https://github.com/woothemes/woocommerce/issues/10098","id":127362939,"number":10098,"title":"woocommerce_order_status_* is being ignored","user":{"login":"BuggeringHell","id":2572212,"avatar_url":"https://avatars.githubusercontent.com/u/2572212?v=3","gravatar_id":"","url":"https://api.github.com/users/BuggeringHell","html_url":"https://github.com/BuggeringHell","followers_url":"https://api.github.com/users/BuggeringHell/followers","following_url":"https://api.github.com/users/BuggeringHell/following{/other_user}","gists_url":"https://api.github.com/users/BuggeringHell/gists{/gist_id}","starred_url":"https://api.github.com/users/BuggeringHell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BuggeringHell/subscriptions","organizations_url":"https://api.github.com/users/BuggeringHell/orgs","repos_url":"https://api.github.com/users/BuggeringHell/repos","events_url":"https://api.github.com/users/BuggeringHell/events{/privacy}","received_events_url":"https://api.github.com/users/BuggeringHell/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-19T04:20:54Z","updated_at":"2016-01-19T10:17:05Z","closed_at":"2016-01-19T09:54:30Z","body":"When setting order item meta data via. woocommerce_order_status_on-hold before 2.5.0, the meta data was included in the order email (both admin and customer), but is no longer present. Was this intended?\r\n"},"comment":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/comments/172804910","html_url":"https://github.com/woothemes/woocommerce/issues/10098#issuecomment-172804910","issue_url":"https://api.github.com/repos/woothemes/woocommerce/issues/10098","id":172804910,"user":{"login":"BuggeringHell","id":2572212,"avatar_url":"https://avatars.githubusercontent.com/u/2572212?v=3","gravatar_id":"","url":"https://api.github.com/users/BuggeringHell","html_url":"https://github.com/BuggeringHell","followers_url":"https://api.github.com/users/BuggeringHell/followers","following_url":"https://api.github.com/users/BuggeringHell/following{/other_user}","gists_url":"https://api.github.com/users/BuggeringHell/gists{/gist_id}","starred_url":"https://api.github.com/users/BuggeringHell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BuggeringHell/subscriptions","organizations_url":"https://api.github.com/users/BuggeringHell/orgs","repos_url":"https://api.github.com/users/BuggeringHell/repos","events_url":"https://api.github.com/users/BuggeringHell/events{/privacy}","received_events_url":"https://api.github.com/users/BuggeringHell/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T10:17:05Z","updated_at":"2016-01-19T10:17:05Z","body":"Here is a similar issue - the function below is not triggered when an order is created using a manual payment method (e.g. Cheque or BACs) which goes from *pending* to *on-hold* immediately upon an order being created. Changing the order back to *pending* and then *on-hold* manually triggers this successfully.\r\n\r\n```php\r\n\r\n// Add 'unassigned' order post meta if virtual gift cards exist in order\r\nadd_action( 'woocommerce_order_status_pending_to_on-hold', 'gift_card_order_meta' );\r\nadd_action( 'woocommerce_order_status_pending_to_processing', 'gift_card_order_meta' );\r\n\r\nfunction gift_card_order_meta( $order_id ) {\r\n\t\r\n\t$gift_card_codes = get_post_meta( $order_id, 'gift_card_codes', true ); \r\n\r\n\tif( empty( $gift_card_codes ) ) {\r\n\t\t$order = wc_get_order( $order_id );\r\n\r\n\t\t$order_items = $order->get_items();\r\n\t\tforeach ( $order_items as $order_item_id => $order_item ) {\r\n\t\t\t\r\n\t\t\t$product_id = $order_item['product_id'];\r\n\t\t\t$product = wc_get_product( $product_id );\r\n\t\t\tif( $product ) {\r\n\t\t\t\t\r\n\t\t\t\t// Make sure order product is a virtual gift card\r\n\t\t\t\tif( has_term( 'gift-cards', 'product_cat', $product_id ) && $product->is_virtual() ) {\r\n\t\t\t\t\tadd_post_meta( $order_id, 'gift_card_codes', 'unassigned' );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n```"}}