wutang
wutang

Reputation: 250

Wordpress and Woocmmerce - how to access settings from theme?

Im trying to pull the settings from Woocommerce admin. I found this:

http://oik-plugins.eu/woocommerce-a2z/oik_api/woocommerce_settings_get_option/

$string = woocommerce_settings_get_option( $option_name, $default );

It looks to be a public function but I cannot access from my theme files. It just gives me Fatal error: Call to undefined. Anyone have any idea how you can access the setting from the theme?

I'm trying to get 'woocommerce_frontend_css_primary', $colors['primary'] so can tie them into the rest of the theme. Woocommerce currently just write the values directly to .less file.

Upvotes: 1

Views: 237

Answers (1)

wutang
wutang

Reputation: 250

Woocommerce docs are a bit misleading, but it turns out there is another function called get_option... as long as you know the name of the option you can use. EG. get array of front end colors:

$woo_styles = get_option( 'woocommerce_frontend_css_colors' );

Upvotes: 3

Related Questions