Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional hooks #20

Open
capuderg opened this issue Feb 3, 2023 · 0 comments
Open

Additional hooks #20

capuderg opened this issue Feb 3, 2023 · 0 comments

Comments

@capuderg
Copy link

capuderg commented Feb 3, 2023

Thank you for creating this plugin! 馃檹

We are using the CheckoutWC plugin and it does not use the wc_ajax_checkout hook, so your rate limiting is not triggered/checked.

We modified your plugin, to use it on our site, but would prefer some additional hooks that we can use and extend its functionality, so we can update your plugin regularly.

Action hook 1:
Here https://github.com/BrianHenryIE/bh-wc-checkout-rate-limiter/blob/master/src/class-bh-wc-checkout-rate-limiter.php#L97, we would need an additional action hook, so we can hook the CheckoutWC ajax hook to your rate limiter. We added this line:
add_action( 'cfw_before_process_checkout', array( $ajax, 'rate_limit_checkout' ), 0 );, so we would need an action hook, like do_action( 'bh_wcr_define_woocommerce_ajax_hooks', $ajax ); in that method.

Action hook2:
Here https://github.com/BrianHenryIE/bh-wc-checkout-rate-limiter/blob/master/src/woocommerce/class-ajax.php#L113, right before the json error response, we would need another action item, because CheckoutWC is expecting a different response, so adding an action hook like this would be awesome: do_action( 'bh_wcr_checkout_rate_limit_exceeded', $rate_limiter );

I'll prepare a quick PR so it will be easier for you, but I don't know which prefix to use for these hooks, because I can see mixed ones being used in the plugin.

capuderg added a commit to capuderg/bh-wc-checkout-rate-limiter that referenced this issue Feb 3, 2023
capuderg added a commit to capuderg/bh-wc-checkout-rate-limiter that referenced this issue Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant