On one of our recent projects, we had to extend WooCommerce Stripe Gateway’s WC_Stripe_Webhook_Handler class in order to modify the check_for_webhook function.
This was not as easy as it seemed. After simply extending the class in the normal PHP way didn’t work, we tried a number of different approaches, including things like using remove_action to remove theirs, then adding ours.
With help from the StackOverflow community and our colleague Dung Nguyen Tien, we solved it by using add_action to add ours with a priority of 9. Here’s the full child class:
As is often the case, the solution was simple once we finally found it.
Let us know if this helps you with your project!
Related Articles
- How to Extend WooCommerce with the WordPress Plugin Boilerplate
- How to Return WooCommerce Advanced Custom Fields Through the WordPress API
- Adding Advanced Custom Fields Google Maps to WooCommerce Quick View Pro
- BSD WooCommerce Stripe Connect Split Pay Released!
0 0 votes
Article Rating