add_action( "woocommerce_email_after_order_table", "webt_woocommerce_email_after_order_table", 10, 1);

function webt_woocommerce_email_after_order_table( $order ) {

/*	if(get_post_meta( $order->id, 'webt_delivery_type', true )=='take_away'){ $order_delivery_type='Take Away';}
	if(get_post_meta( $order->id, 'webt_delivery_type', true )=='levering'){	$order_delivery_type='Delivery';}*/
		$order_id = version_compare( WC_VERSION, '3.0.0', '<' ) ? $order->id : $order->get_id();
		
		if(get_post_meta( $order_id, 'webt_delivery_type', true )=='take_away'){

			if(!empty(get_option('webt_takeaway_lable'))) 
			{ 
				$order_delivery_type =  get_option('webt_takeaway_lable'); 
			} 
			else 
			{ 
				$order_delivery_type = 'Take away';
			}
			
		}

	if(get_post_meta( $order_id, 'webt_delivery_type', true )=='levering'){

			if(!empty(get_option('webt_delivery_lable'))) 
			{ 
				$order_delivery_type =  get_option('webt_delivery_lable'); 
			} 
			else 
			{ 
				$order_delivery_type = 'Delivery';
			}

		}

echo '<p></p><p><strong>'.__('Delivery date','byconsole-woo-order-delivery-time').':</strong> ' . get_post_meta( $order_id, 'webt_delivery_date', true ) . '</p>';


	echo '<p><strong>'.__('Delivery time','byconsole-woo-order-delivery-time').':</strong> ' . get_post_meta( $order_id, 'webt_delivery_time', true ) . '</p>';

	echo '<p><strong>'.__('Delivery type','byconsole-woo-order-delivery-time').':</strong> ' . $order_delivery_type . '</p>';


}
Your Answer
Login
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.