Send email with custom fields after new draft is saved or new post published

I think you need to handle post request first. You have to do this because gutenberg calls the hook twice. function transition_post_status_handler( $new_status, $old_status, $post ) { if ( defined( ‘REST_REQUEST’ ) && REST_REQUEST ) { send_mail_on_publish( $new_status, $old_status, $post ); set_transient( ‘post_status_updater_flag’, ‘done’, 10 ); } else { if ( false === get_transient( ‘post_status_updater_flag’ … Read more

How to display custom option field in woocommerce orders in admin panel?

You have forgot to save custom meta field data so check it below code I have done it. Reference add_filter( ‘woocommerce_checkout_fields’ , ‘occasion_checkout_field_update_order_meta’ ); function occasion_checkout_field_update_order_meta( $fields ) { $fields[‘billing’][‘occasion’] = array( ‘type’ => ‘select’, ‘id’ => ‘occasion’, ‘placeholder’ => __(‘Select Occasion’, ‘woocommerce’), ‘required’ => false, ‘class’ => array(‘form-row-wide’), ‘clear’ => false, ‘options’ => array( … Read more