Totally new to Bedrock. I am running just Bedrock, with a self-coded theme on Laravel Forge.
I want to set a serialised key’s value in the wp_optionsDB table using the .env variable. For example in staging:
STRIPE_TEST_MODE=TRUE
PAYPAL_SANDBOX_MODE=TRUE
Then depending on the environment, set the wp_option to reflect that setting.
I tried conditionally running a wp cli command: wp patch update woocommerce_stripe_settings testmode yes
But this feels wrong and I wasn’t sure when that command should be run? Maybe after_theme_switch action or maybe on the deploy script in in Laravel Forge?
Ive taken a quick look and it doesn’t look like there’s a hook to enable the testmode, but you could always hook into pre_options_{$option} and modify the output based on your env setting.
Also, I don’t think the dot env file is the best place for it, the config/environment.php is.