payment_gateways->process_admin_options(); break; case "shipping" : woocommerce_update_options( $woocommerce_settings[ $current_tab ] ); $woocommerce->shipping->process_admin_options(); break; default : if ( isset( $woocommerce_settings[ $current_tab ] ) ) woocommerce_update_options( $woocommerce_settings[ $current_tab ] ); // Trigger action for tab do_action( 'woocommerce_update_options_' . $current_tab ); break; } do_action( 'woocommerce_update_options' ); // Handle Colour Settings if ( $current_tab == 'general' && get_option('woocommerce_frontend_css') == 'yes' ) { // Save settings $primary = ( ! empty( $_POST['woocommerce_frontend_css_primary'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_primary'] ) : ''; $secondary = ( ! empty( $_POST['woocommerce_frontend_css_secondary'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_secondary'] ) : ''; $highlight = ( ! empty( $_POST['woocommerce_frontend_css_highlight'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_highlight'] ) : ''; $content_bg = ( ! empty( $_POST['woocommerce_frontend_css_content_bg'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_content_bg'] ) : ''; $subtext = ( ! empty( $_POST['woocommerce_frontend_css_subtext'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_subtext'] ) : ''; $colors = array( 'primary' => $primary, 'secondary' => $secondary, 'highlight' => $highlight, 'content_bg' => $content_bg, 'subtext' => $subtext ); $old_colors = get_option( 'woocommerce_frontend_css_colors' ); update_option( 'woocommerce_frontend_css_colors', $colors ); if ( $old_colors != $colors ) woocommerce_compile_less_styles(); } } else { // If saving a shipping methods options, load 'er up if ( ( $current_tab == 'shipping' || $current_tab == 'payment_gateways' && class_exists( $current_section ) ) ) { $current_section_class = new $current_section(); do_action( 'woocommerce_update_options_' . $current_tab . '_' . $current_section_class->id ); // If saving an email's options, load theme } elseif ( $current_tab == 'email' ) { // Load mailer $mailer = $woocommerce->mailer(); if ( class_exists( $current_section ) ) { $current_section_class = new $current_section(); do_action( 'woocommerce_update_options_' . $current_tab . '_' . $current_section_class->id ); } else { do_action( 'woocommerce_update_options_' . $current_tab . '_' . $current_section ); } // Save tax } elseif ( $current_tab == 'tax' ) { include_once('settings/settings-tax-rates.php'); woocommerce_tax_rates_setting_save(); } else { // Save section only do_action( 'woocommerce_update_options_' . $current_tab . '_' . $current_section ); } } // Clear any unwanted data $woocommerce->clear_product_transients(); delete_transient( 'woocommerce_cache_excluded_uris' ); // Redirect back to the settings page $redirect = add_query_arg( 'saved', 'true' ); if ( ! empty( $_POST['subtab'] ) ) $redirect = add_query_arg( 'subtab', esc_attr( str_replace( '#', '', $_POST['subtab'] ) ), $redirect ); wp_safe_redirect( $redirect ); exit; } // Get any returned messages $error = ( empty( $_GET['wc_error'] ) ) ? '' : urldecode( stripslashes( $_GET['wc_error'] ) ); $message = ( empty( $_GET['wc_message'] ) ) ? '' : urldecode( stripslashes( $_GET['wc_message'] ) ); if ( $error || $message ) { if ( $error ) { echo '
' . esc_html( $error ) . '
' . esc_html( $message ) . '
' . __( 'Your settings have been saved.', 'woocommerce' ) . '
' . wp_kses_post( $description ) . '
'; } elseif ( $description ) { $description = '' . wp_kses_post( $description ) . ''; } if ( $tip && in_array( $value['type'], array( 'checkbox' ) ) ) { $tip = '' . $tip . '
'; } elseif ( $tip ) { $tip = ''; } // Switch based on type switch( $value['type'] ) { // Section Titles case 'title': if ( ! empty( $value['title'] ) ) echo '