Compatibility – Point of Sale for WooCommerce
-
Hi guys,
We noticed that “cfturnstile_woo_register_check” only checks if it is not backend and then gets added always. We have a use case in which we use Point of Sale for WooCommerce; https://woocommerce.com/products/point-of-sale-for-woocommerce/
This adds an option to register a user from the POS side through a WP-JSON call. Sadly your check gets called, but the Cloudflare Turnstile challenge etc does not. leading into always returning the error message setup in your plugin.
We have now edited /inc/woocommerce.php to also check if we are doing a wp-json request with a simple;
// Check if the current request is made to wp-json function is_wp_json_request() { $request_uri = $_SERVER['REQUEST_URI']; $request_path = parse_url($request_uri, PHP_URL_PATH); $json_endpoint = '/wp-json/'; return strpos($request_path, $json_endpoint) !== false; } if(!is_admin()) { // Prevents admin registration from failing if (is_wp_json_request()) { } else { add_action('woocommerce_register_post', 'cfturnstile_woo_register_check', 10, 3); } }
Which works, but is not ideal, as we can not update the plugin.
Please consider adding something to prevent these type of issues.
Best regards,
Patrick Dankers
- The topic ‘Compatibility – Point of Sale for WooCommerce’ is closed to new replies.