@@ -150,13 +150,13 @@ public static function get_css_variables() {
150
150
return [
151
151
'background_color ' => apply_filters (
152
152
'orbit_branded_emails_background_color ' ,
153
- get_option ( 'woocommerce_email_background_color ' ) ?:
153
+ self :: get_woocommerce_setting ( 'woocommerce_email_background_color ' ) ?:
154
154
'#ffffff '
155
155
),
156
156
157
157
'body_background_color ' => apply_filters (
158
158
'orbit_branded_emails_body_background_color ' ,
159
- get_option ( 'woocommerce_email_body_background_color ' ) ?:
159
+ self :: get_woocommerce_setting ( 'woocommerce_email_body_background_color ' ) ?:
160
160
'#ffffff '
161
161
),
162
162
@@ -170,7 +170,7 @@ public static function get_css_variables() {
170
170
171
171
'body_text_color ' => apply_filters (
172
172
'orbit_branded_emails_body_text_color ' ,
173
- get_option ( 'woocommerce_email_text_color ' ) ?:
173
+ self :: get_woocommerce_setting ( 'woocommerce_email_text_color ' ) ?:
174
174
self ::orbit_branded_emails_resolve_color (
175
175
'var(--wp--preset--color--contrast) '
176
176
) ?:
@@ -179,7 +179,7 @@ public static function get_css_variables() {
179
179
180
180
'link_color ' => apply_filters (
181
181
'orbit_branded_emails_link_color ' ,
182
- get_option ( 'woocommerce_email_base_color ' ) ?:
182
+ self :: get_woocommerce_setting ( 'woocommerce_email_base_color ' ) ?:
183
183
self ::orbit_branded_emails_resolve_color (
184
184
'var(--wp--custom--color--link) '
185
185
) ?:
@@ -188,18 +188,22 @@ public static function get_css_variables() {
188
188
189
189
'footer_text_color ' => apply_filters (
190
190
'orbit_branded_emails_footer_text_color ' ,
191
- get_option ( 'woocommerce_email_footer_text_color ' ) ?:
191
+ self :: get_woocommerce_setting ( 'woocommerce_email_footer_text_color ' ) ?:
192
192
self ::orbit_branded_emails_resolve_color (
193
193
'var(--wp--preset--color--contrast) '
194
194
) ?:
195
195
'#3F474d '
196
196
),
197
197
198
- 'font_family ' => '"Helvetica Neue", Helvetica, Roboto, Arial, sans-serif ' ,
198
+ 'font_family ' => apply_filters (
199
+ 'orbit_branded_emails_font_family ' ,
200
+ self ::get_woocommerce_setting ( 'woocommerce_email_font_family ' ) ?:
201
+ '"Helvetica Neue", Helvetica, Roboto, Arial, sans-serif '
202
+ ),
199
203
200
204
'logo_image_width ' => apply_filters (
201
205
'orbit_branded_emails_logo_image_width ' ,
202
- get_option ( 'woocommerce_email_header_image_width ' ) ?:
206
+ self :: get_woocommerce_setting ( 'woocommerce_email_header_image_width ' ) ?:
203
207
120
204
208
),
205
209
];
@@ -306,4 +310,21 @@ public static function apply_branded_email_colours_to_gf_table_data( $color, $fi
306
310
307
311
return $ data_background_color ;
308
312
}
313
+
314
+ /**
315
+ * Checks if WooCommerce is active and retrieves a specific setting.
316
+ *
317
+ * Should only be used for settings that are expected to be set by WooCommerce.
318
+ *
319
+ * @param string $setting_name The name of the WooCommerce setting to retrieve.
320
+ * @return mixed|null The value of the setting, or null if WooCommerce is not active or the setting does not exist.
321
+ */
322
+ public static function get_woocommerce_setting ( $ setting_name ) {
323
+ // check if woocommerce is active
324
+ if ( ! class_exists ( 'WooCommerce ' ) ) {
325
+ return null ;
326
+ }
327
+
328
+ return get_option ( $ setting_name ) ?: null ;
329
+ }
309
330
}
0 commit comments