Version 7+ Deprecated Hook Issues
-
I just updated to version 7 and am seeing critical errors when trying to print invoices. The issue appears to be the way that you used do_action_deprecated. You kept the hook name the same but changed how the arguments are passed. For instance, I am using the “wcdn_order_item_before” hook. Here’s what it looks like in the base.php template file.
https://cleanshot.com/share/t55z3Js8
The same hook is running twice but with different arguments. The function I used previously treated the first argument as an object, not an array. So I switched it to treat it as an array. However, it still throws an error because the first instance of the hook that runs in do_action_deprecated expects it to be an object. The new hook needs to have a completely different name or users will have to write some kind of conditional to detect if the passed variable is an object or an array.
You must be logged in to reply to this topic.