Add floating mode support
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Ogre\Captcha\Location\WooCommerce;
|
||||
use Override;
|
||||
use Ogre\Captcha\Location;
|
||||
use Ogre\Captcha\Settings;
|
||||
use Ogre\Captcha\Widget;
|
||||
use WP_Error;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -33,9 +34,17 @@ final class Checkout extends Location {
|
||||
public function activate(): void
|
||||
{
|
||||
add_action('woocommerce_after_checkout_billing_form', [$this, 'render']);
|
||||
add_filter('woocommerce_order_button_html', [$this, 'submit_button'], 10, 1);
|
||||
add_action('woocommerce_after_checkout_validation', [$this, 'process_form'], 10, 2);
|
||||
}
|
||||
|
||||
public function submit_button(string $html):string {
|
||||
if (Settings::is_widget_floating()) {
|
||||
$html = Widget::set_button_floating($html);
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function process_form(array $data, WP_Error $errors) {
|
||||
$this->process($errors);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user