Automattic\WooCommerce\Internal\Email

EmailStyleSync::update_email_colorsprotectedWC 1.0

Update email colors from theme colors.

Method of the class: EmailStyleSync{}

No Hooks.

Returns

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->update_email_colors();

EmailStyleSync::update_email_colors() code WC 9.9.4

protected function update_email_colors() {
	$colors = $this->get_theme_colors();
	if ( empty( $colors ) ) {
		return;
	}

	if ( ! empty( $colors['base_color'] ) ) {
		update_option( 'woocommerce_email_base_color', $colors['base_color'] );
	}

	if ( ! empty( $colors['bg_color'] ) ) {
		update_option( 'woocommerce_email_background_color', $colors['bg_color'] );
	}

	if ( ! empty( $colors['body_bg_color'] ) ) {
		update_option( 'woocommerce_email_body_background_color', $colors['body_bg_color'] );
	}

	if ( ! empty( $colors['body_text_color'] ) ) {
		update_option( 'woocommerce_email_text_color', $colors['body_text_color'] );
	}

	if ( ! empty( $colors['footer_text_color'] ) ) {
		update_option( 'woocommerce_email_footer_text_color', $colors['footer_text_color'] );
	}
}