Handle process navigation better

This commit is contained in:
Almira Krdzic
2018-11-03 11:15:52 +01:00
parent 26f997abbc
commit 8d4f75cc41
8 changed files with 168 additions and 38 deletions

View File

@@ -294,8 +294,12 @@ class Wiaas_Cart {
}
/**
* Persist used payment type information for package in corresponding order line item.
* Also for standard package type list of addons and options will be saved.
* Persist additional metadata for every order item
* This includes:
*
* 1. payment info
* 2. relation info for addons and options
* 3. prices for simple products
*
* @param $order_item
* @param $cart_item_key
@@ -374,6 +378,27 @@ class Wiaas_Cart {
$order_item->add_meta_data( '_wiaas_documents', $item_documents, true );
}
// save simple product information that needs to be avaialable later on
// even if this data is changed or removed from product at that time
$simple_product_meta = array();
if(wc_pb_is_bundled_cart_item($cart_item)) {
$product = $cart_item['data'];
$simple_product_meta['_wiaas_category'] = Wiaas_Product_Category::get_category($product);
$simple_product_meta['_wiaas_price'] = $product->get_price();
$simple_product_meta['_wiaas_manufacturer_product_no'] = $product->get_meta('_manufacturer_product_no');
$simple_product_meta['_wiaas_supplier_product_no'] = $product->get_meta('_supplier_product_no');
// get supplier
if ($supplier_organization_id = Wiaas_Product_Supplier::get_supplier_organisation_id_from_product($product->get_id())) {
$info = wiaas_get_organization_info($supplier_organization_id);
$simple_product_meta['_wiaas_supplier_info'] = $info;
}
}
return $order_item;
}