function sync_product_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_product_to_fortnox($_POST['product_id']); echo json_encode($message); die; // this is required to return a proper result }
/** * Sends product to Fortnox API * * @access public * @param $productId * @internal param int $productId */ public function send_product_to_fortnox($productId) { include_once "class-woo-fortnox-controller.php"; $controller = new WC_Fortnox_Controller(); $controller->send_product_to_fortnox($productId); }