Fatal error: Uncaught Error: Using $this when not in object context
-
Hi!
Loving the plugin. Great work! I’m currently trying to hook into
do_action( 'simpay_process_form', $this );
in order to add some meta data into the transaction info sent to Stripe.In my functions file I created the following basic code:
add_action('simpay_process_form', 'bbs_simpay_process_form'); function bbs_simpay_process_form() { $this->metadata = array("special_order_info" => "6735"); }
Unfortunately this throws the following error:
Fatal error: Uncaught Error: Using $this when not in object context...
I tried renaming the function tofunction bbs_simpay_process_form($this)
but that doesn’t work as the hook function happens outside of the scope of the object.How do you suggest I go about adding this information into the hook/transaction properly?
Thanks!
David
- The topic ‘Fatal error: Uncaught Error: Using $this when not in object context’ is closed to new replies.