/** * mijireh_notification function. * * @access public * @return void */ public function mijireh_notification() { global $woocommerce; $this->init_mijireh(); try { $mj_order = new Mijireh_Order(esc_attr($_GET['order_number'])); $wc_order_id = $mj_order->get_meta_value('wc_order_id'); $wc_order = new WC_Order(absint($wc_order_id)); // Mark order complete $wc_order->payment_complete(); // Empty cart and clear session $woocommerce->cart->empty_cart(); wp_redirect($this->get_return_url($wc_order)); exit; } catch (Mijireh_Exception $e) { $woocommerce->add_error(__('Mijireh error:', 'woocommerce') . $e->getMessage()); } }
/** * mijireh_notification function. * * @access public * @return void */ public function mijireh_notification() { if (isset($_GET['order_number'])) { $this->init_mijireh(); try { $mj_order = new Mijireh_Order(esc_attr($_GET['order_number'])); $wc_order_id = $mj_order->get_meta_value('wc_order_id'); $wc_order = new WC_Order(absint($wc_order_id)); // Mark order complete $wc_order->payment_complete(); // Empty cart and clear session WC()->cart->empty_cart(); wp_redirect($this->get_return_url($wc_order)); exit; } catch (Mijireh_Exception $e) { wc_add_notice(__('Mijireh error:', 'woocommerce') . $e->getMessage(), 'error'); } } elseif (isset($_POST['page_id'])) { if (isset($_POST['access_key']) && $_POST['access_key'] == $this->access_key) { wp_update_post(array('ID' => $_POST['page_id'], 'post_status' => 'private')); } } }