I'm making a custom payment gateway. The complex parts are going fine but I've now been stuck on something stupid for hours.
I've created custom settings for the gateway without issue, they can be set and saved, but I can't figure out how to recall them in other functions.
If I place var_dump($this->get_option('title'))
within the custom gateway class (which extends WC_Payment_Gateway
) it will show correctly at the top of the settings page. Anywhere else, it won't. I've tried now hundreds of things, like trying to access this class by $this = new WC_Custom_Gateway, making the functions involved public, and utilising init_settings()
.. I'm sure there is a very simple solution, but as a beginner I just cannot see it. I've tried examining the work of others to no avail also.
How can I make those settings available from outside the class where they are defined in?