<?php
global $wpdb;
$order_id = $_POST['order_number'];
$order = $wpdb->get_results ( "SELECT order_item_id, order_item_name FROM woocommerce_order_items WHERE order_id = '$order_id'");
foreach ($order as $page) {
echo $page->order_item_id.'<br/>'.$page->order_item_name;
$meta_id = $page->order_item_id;
$entity = $page->order_item_name;
}
$sql = $wpdb->get_results ( "SELECT
CASE WHEN $entity = 'ABC'
THEN CONCAT(meta_key ='First Name', IF (CHAR_LENGTH(meta_key = 'Middle Name') > 0, CONCAT(meta_key = 'Middle Name')), meta_key ='Last Name')
WHEN $entity = DEF'
THEN CONCAT(meta_key ='First Name', IF (CHAR_LENGTH(meta_key = 'Middle Name') > 0, CONCAT(meta_key = 'Middle Name')), meta_key ='Last Name')
ELSE meta_key ='LLCName'
END
AS 'f1_02(0)'
FROM
woocommerce_order_itemmeta
WHERE order_item_id = '$meta_id'");
foreach ( $sql as $page )
{
echo $page->f1_02(0);
}
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
This award recognizes a member of Experts Exchange who has made outstanding contributions to the community within their first year as an expert. The Rookie of the Year is awarded to a new expert who has the highest number of quality contributions.