« first day (3337 days earlier)      last day (1607 days later) » 

9:52 AM
0
Q: How to ask off-topic questions: just award a bounty

keroJust saw this question WooCommerce Tax Filter Not Fired. It is about WooCommerce, so I quickly wanted to vote-close it as off topic but got a notice: This question has an open bounty and cannot be closed Is this the desired behavior? How should we proceed in cases like this?

 
 
9 hours later…
6:26 PM
Yaakov Ellis on December 05, 2019

We know that giving our community mechanisms for sharing and receiving feedback is important. In her recent blog post, Meg Risdal described some of the ways that our Public Q&A product team is working to improve the way our system helps users share and receive feedback. I’m pleased to announce that starting today we are rolling out our new post notice system on Stack Overflow and across the entire Stack Exchange network. 

As a reminder, post notices are the informational banners that sometimes appear on closed, duplicate, and other questions. …

 
 
3 hours later…
9:48 PM
Hello fellows
 
10:05 PM
Hello!
 
How do you guys deal with variable scoping in PHP, do you use alot of global keywords? I kinda like the JS scope idea better where the scope is global if its declared outside any functions. Recently i just noticed how much workaround i had to do just to pass an local variable to an filter hook.
 
I've never needed to pass a local variable to a filter hook. I try to stay away from globals if I can, sometimes you can't. What was the use-case?
 
10:41 PM
Im just interested to see if its another way around it, you can see the pseudo code of my use case here: 3v4l.org/moO0g
 
11:14 PM
I guess the question is why is the price variable outside of the function / hook scopes? Could you make generating this new price a function and then just call that function in your hooks?
 
avoid global state, even in JS
you can pass things in via dependency injection
I know you can reference things one scope up in JS at times, but that shouldn't be used with global variables
afterall remember a global variable in JS is just a variable in window
also it sounds like a stateful object would have been a far better choice
then you could have done: $this->price
or used a filter to grab it
eitherway it sounds like there's some misunderstandings going on about how things work, or, the user of magic hardcoded numbers
remember, PHP requests are handled by their own processes, there's no sharing of variables you set
once a request has been handled, the program finishes, and the next request has to load all of WP and bootstrap it from scratch
so what you're trying to do is unusual in WP
and for most people, the answer for how to do it is... don't
 

« first day (3337 days earlier)      last day (1607 days later) »