add variable to actions/functions across different files (woocommerce)
Not really. Anything that loads a template in WordPress is ultimately an include() or require() and only the variables in the caller function scope (and global scope of course) are passed on to the included file: function foo() { $bar = 1; include( ‘/path/to/template.php’ ); } $baz = 2; foo(); // template.php: echo $bar; // … Read more