How to Extend WC_Stripe_Webhook_Handler

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 me know if this helps you with your project!

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x