get_id()); if(!$orderData) return; $user = get_user_by( 'id', $orderData['user_id'] ); ?>

display_name ); ?>

Maksym Marko -

getRow(MXALFWP_ORDERS_TABLE_SLUG, 'order_id', intval($id)); // date $date = gmdate('Y-m-d H:i:s'); // create order if($orderData == NULL) { // if no cookies if (!isset($_COOKIE['mxalfwpLinkIdentifier'])) return; $linkKey = sanitize_text_field( wp_unslash( $_COOKIE['mxalfwpLinkIdentifier'] ) ); $and = "AND link_key = '$linkKey' AND status = 'active'"; $linkData = $inst->getRow(NULL, 1, 1, $and); if ($linkData == NULL) return; $orderWC = wc_get_order($id); $amount = $orderWC->get_total(); $insert = $inst->insertRow( MXALFWP_ORDERS_TABLE_SLUG, [ 'order_id' => $id, 'user_id' => $linkData->user_id, 'link_id' => $linkData->id, 'status' => $next_status, 'amount' => $amount, 'created_at' => $date, 'updated_at' => $date, ], [ '%d', '%d', '%d', '%s', '%s', '%s', '%s', ] ); return; } // update order if($orderData !== NULL) { // get link key by order id $linkKey = mxalfwpGetLinkKeyByOrderId($id); if (!$linkKey) return; $linkKey = sanitize_text_field($linkKey); $and = "AND link_key = '$linkKey' AND status = 'active'"; $linkData = $inst->getRow(NULL, 1, 1, $and); if ($linkData == NULL) return; $orderWC = wc_get_order($id); $amount = $orderWC->get_total(); // update $updated = $inst->updateRow( MXALFWP_ORDERS_TABLE_SLUG, 'order_id', intval($id), [ 'status' => $next_status, 'amount' => $amount, 'updated_at' => $date, ], [ '%s', '%d', '%s', ] ); return; } return; } } (new MXALFWPIntegrationWoocommerce)->registerActions();