function sync_order_callback() { global $wpdb; // this is how you get access to the database include_once "class-woo-fortnox-controller.php"; check_ajax_referer('fortnox_woocommerce', 'security'); $controller = new WC_Fortnox_Controller(); $message = $controller->send_contact_to_fortnox($_POST['order_id']); echo json_encode($message); die; // this is required to return a proper result }
/** * Sends contact of given order to Fortnox API * * @access public * @param int $orderId */ public function synchronize_order_on_complete($orderId) { include_once "class-woo-fortnox-controller.php"; $options = get_option('woocommerce_fortnox_general_settings'); if (!isset($options['activate-automatic-orders'])) { return; } $controller = new WC_Fortnox_Controller(); $controller->send_contact_to_fortnox($orderId); }