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 10.8.1

protected function update_email_colors() {
	$colors = EmailColors::get_default_colors();
	if ( empty( $colors ) ) {
		return;
	}

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

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

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

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

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