delivery step actions
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Retrieve order suppliers
|
||||
*
|
||||
* @param int|WC_Order $order
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function wiaas_get_order_suppliers($order) {
|
||||
|
||||
if (is_numeric($order)) {
|
||||
|
||||
$order = wc_get_order($order);
|
||||
}
|
||||
|
||||
$items = $order->get_items();
|
||||
|
||||
$suppliers = get_terms(array(
|
||||
'taxonomy' => 'supplier',
|
||||
'fields' => 'id=>name',
|
||||
'hide_empty' => false
|
||||
));
|
||||
|
||||
return $suppliers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve standard bundles from order
|
||||
*
|
||||
* @param int|WC_Order $order
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function wiaas_get_order_standard_bundle_items($order) {
|
||||
|
||||
if (is_numeric($order)) {
|
||||
|
||||
$order = wc_get_order($order);
|
||||
}
|
||||
|
||||
$items = $order->get_items();
|
||||
|
||||
$standard_bundle_items = array();
|
||||
|
||||
foreach ($items as $item) {
|
||||
|
||||
if (isset($item['wiaas_standard_package'])) {
|
||||
|
||||
$standard_bundle_items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
return $standard_bundle_items;
|
||||
}
|
||||
Reference in New Issue
Block a user