ID);
break;
case 'wiaas_commercial_lead':
$column_content = Wiaas_Order::get_order_commercial_lead_name($post->ID);
break;
case 'wiaas_customer':
$column_content = Wiaas_Order::get_order_customer_full_name($post->ID);
$customer_organization_info = Wiaas_Order::get_customer_organization_info($post->ID);
if ( ! empty($customer_organization_info) ) {
$column_content .= '
';
$column_content .= '' . $customer_organization_info['name'] . '';
}
break;
}
echo $column_content;
}
/**
* Filter default hidden columns for orders list
*
* @param array $hidden
* @param object $screen
*
* @return array
*/
public static function filter_orders_list_default_hidden_columns($hidden, $screen) {
if (isset($screen->id) && $screen->id === 'edit-shop_order') {
$hidden = array( 'wc_actions' );
}
return $hidden;
}
/**
* Add custom information to order preview data
*
* @param array $order
*
* @return array
*/
public static function add_custom_data_to_order_preview ($order) {
$order['wiaas_commercial_lead_name'] = Wiaas_Order::get_order_commercial_lead_name( $order['data']['id'] );
$order['needs_shipping'] = true;
return $order;
}
/**
* Display custom information in order preview
*
*/
public static function show_custom_data_before_order_preview () {
echo '
Commercial lead
{{data.wiaas_commercial_lead_name}}
';
}
/**
* Display only bundles (not simple products)
*
* This will also not display options and addons
*
* @param array $order_items
*
* @return array
*/
public static function remove_simple_items_from_preview( $order_items){
$items = array();
foreach ($order_items as $order_item) {
if ( Wiaas_Order_Item::is_standard_bundle($order_item) ) {
$items[] = $order_item;
}
}
return $items;
}
/**
* Columns for order preview order items table
*
* @return array
*/
public static function order_preview_order_item_columns( ) {
return array(
'product' => __('Product', 'wiaas'),
'quantity' => __( 'Quantity', 'wiaas' ),
'wiaas_order_item_price' => __( 'Price', 'wiaas' )
);
}
/**
* @param $empty
* @param WC_Order_Item $item
* @param int $item_id
* @param WC_Order $order
*
* @return string
*/
public static function render_order_item_preview_price_column($empty, $item, $item_id, $order) {
if (Wiaas_Order_Item::is_standard_bundle($item)) {
$total_price = wc_price( $item->get_total(), array( 'currency' => $order->get_currency() ) );
$monthly_price = wc_price(
Wiaas_Order_Item::get_monthly_recurring_total($item),
array( 'currency' => $order->get_currency() )
);
return sprintf('On Delivery: %s
Monthly: %s',
$total_price,
$monthly_price);
}
return '';
}
/**
* Render order item payment info with order item metadata on order details page
*
* @param $item_id
* @param WC_Order_Item $item
* @param $product
*/
public static function render_order_details_order_item_custom_info($item_id, $item, $product) {
if (Wiaas_Order_Item::is_standard_bundle($item)) {
$order = $item->get_order();
$total_price = wc_price( $item->get_total(), array( 'currency' => $order->get_currency() ) );
$monthly_price = wc_price(
Wiaas_Order_Item::get_monthly_recurring_total($item),
array( 'currency' => $order->get_currency() )
);
?>
On Delivery:
Monthly:
key) {
case '_wiaas_payment_type':
return 'Payment type';
case '_wiaas_services_extra':
return 'Services and support price';
case '_wiaas_recurrent_extra':
return 'Recurrent price';
default:
return $display_key;
}
}
/**
* @param string $display_value
* @param object $meta
* @param WC_Order_Item $item
*
* @return string
*/
public static function order_item_display_meta_value($display_value, $meta, $item) {
switch ($meta->key) {
case '_wiaas_services_extra':
$order = $item->get_order();
return wc_price(
Wiaas_Order_Item::get_services_total($item),
array( 'currency' => $order->get_currency())
);
case '_wiaas_recurrent_extra':
$order = $item->get_order();
return wc_price(
Wiaas_Order_Item::get_recurrent_total($item),
array( 'currency' => $order->get_currency())
);
default:
return $display_value;
}
}
}
Wiaas_Admin_Orders::init();