Update delivery process fields and sample form

This commit is contained in:
Almira Krdzic
2018-11-04 13:20:13 +01:00
parent e8a3668c25
commit a6640548ef
16 changed files with 170 additions and 298 deletions

View File

@@ -85,10 +85,10 @@ class Wiaas_Delivery_Process {
* @param $form
*/
public static function maybe_complete_parent_order($entry_id, $form) {
$entry = GFAPI::get_entry($entry_id);
$order_field = GFCommon::get_fields_by_type($form, 'wiaas_order')[0];
$order_id = empty($order_field) ? null : absint($entry[$order_field->id]);
$order_id = $entry['wiaas_delivery_order_id'];
if (!isset($order_id)) {
return;
@@ -97,7 +97,7 @@ class Wiaas_Delivery_Process {
$process_entry_id = get_post_meta($order_id, 'wiaas_delivery_process_entry_id', true);
// order process entry completed, so complete order
if (absint($process_entry_id) === $entry_id) {
if (absint($process_entry_id) === absint($entry_id)) {
$order = wc_get_order($order_id);
$order->update_status('completed', 'Completed order delivery process.', true);
}