WooCommerce: Fit All Settings In One Page

In the world of WooCommerce, customization is crucial for creating a unique online store. However, juggling numerous WooCommerce settings across multiple pages can be tedious.

Imagine a solution that simplifies this process by consolidating all your WooCommerce options into a single, easy-to-use interface.

This tutorial will give you a possible approach and try to fit all WooCommerce Settings into a single screen (so, on the same page, you can edit the general, products, shipping, payments, advanced, etc. options).

Enjoy!

As you can see there is a new nav bar, and on click you scroll down to the specific options section. In this screenshot you can appreciate the bottom of the “Shipping” options section, and the top of the “Payments” options section. It’s all in one page!

PHP Snippet: All WooCommerce Settings In One Page

Please note that the solution below still doesn’t work with subtabs (e.g. they redirect to the actual subtab page), but at least the parent tabs (General, Products, etc.) are working fine. If you wish to complete the code, feel free to contribute.

/**
 * @snippet       1-page Woo Settings layout
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 9
 * @community     https://businessbloomer.com/club/
 */

add_action( 'woocommerce_before_settings_general', 'bbloomer_woo_settings_tabs_navbar_replacement' );

function bbloomer_woo_settings_tabs_navbar_replacement() {
	
	$tabs = apply_filters( 'woocommerce_settings_tabs_array', [] );
	
	?>
		<nav class="nav-tab-wrapper woo-nav-tab-wrapper infinite">
			<?php

			foreach ( $tabs as $slug => $label ) {
				echo '<a href="#' . $slug . '" class="nav-tab">' . esc_html( $label ) . '</a>';
			}
	
			?>
		</nav>
				
		<style>
				.woocommerce nav.woo-nav-tab-wrapper:not(.infinite) { display: none }
				.woocommerce nav.woo-nav-tab-wrapper.infinite { background: Cornsilk; box-sizing: border-box; padding: 5px; position: sticky; top: 50px; z-index: 1001; margin: 0; width: calc(100% - 100px); }
		</style>
				
	<?php
}

add_action( 'woocommerce_after_settings_general', 'bbloomer_display_settings_tabs_content_after_general_one' );

function bbloomer_display_settings_tabs_content_after_general_one() {
	
	$tabs = apply_filters( 'woocommerce_settings_tabs_array', [] );
	unset( $tabs['general'] );
	
	foreach ( $tabs as $current_tab => $label ) {	
	
		echo '<hr id="' . $current_tab . '">';
		echo '<h1 style="text-transform:capitalize">' . $label . ' ' . __( 'Settings', 'woocommerce' ) . '</h1>';

		// SAVE SETTINGS
		if ( ! empty( $_POST[ 'save' . $current_tab ] ) ) {
			check_admin_referer( 'woocommerce-settings' );
			do_action( 'woocommerce_settings_save_' . $current_tab );
			do_action( 'woocommerce_update_options_' . $current_tab );
			do_action( 'woocommerce_update_options' );
			update_option( 'woocommerce_queue_flush_rewrite_rules', 'yes' );
			WC()->query->init_query_vars();
			WC()->query->add_endpoints();
			do_action( 'woocommerce_settings_saved' );
		}

		do_action( 'woocommerce_before_settings_' . $current_tab );
		?>
			<form method="<?php echo esc_attr( apply_filters( 'woocommerce_settings_form_method_tab_' . $current_tab, 'post' ) ); ?>" id="mainform<?php echo $current_tab; ?>" action="" enctype="multipart/form-data">
		<?php
		do_action( 'woocommerce_sections_' . $current_tab );
		do_action( 'woocommerce_settings_' . $current_tab );
		?>
			<p class="submit">
				<button name="save<?php echo $current_tab; ?>" class="woocommerce-save-button components-button is-primary" type="submit" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>"><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
				<?php wp_nonce_field( 'woocommerce-settings' ); ?>
			</p>
			</form>
		<?php 
		do_action( 'woocommerce_after_settings_' . $current_tab );
	
	}
	
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Add Second Description @ Product Category Pages
    In terms of SEO, if you’re trying to rank your product category pages, you really need to make the most of the default WooCommerce product category “description” and “thumbnail”. Most themes, if compatible with WooCommerce, will show this content right below the product category name and above products. Nothing new so far. But what if […]
  • WooCommerce: Add Column to Orders Table @ WP Dashboard
    The WooCommerce Orders Table, which can be found under WP Dashboard > WooCommerce > Orders, provides us with 7 default columns: Order – Date – Status – Billing – Ship to – Total – Actions. This is used by shop managers to have an overview of all orders, before eventually clicking on a specific one. […]
  • WooCommerce: Hide/Show The WP Admin Bar
    In previous WooCommerce versions, new customers could access the WP Admin black bar after purchase. Now this seems fixed. Still, what about other user roles, and what if you want to override this default behavior? Well, here’s a quick snippet for you – feel free to use it in your own WooCommerce site. Enjoy!
  • WooCommerce: Display Custom Filters @ WP Dashboard > Products
    If you go to WordPress Dashboard > Products you will find default product admin filters such as “Select a category”, “Filter by product type”, “Filter by stock status”. What if you want to add more custom filters to let your shop managers find products easily? For example, you could add “Filter by product tag” (“product […]
  • WooCommerce: Access Thank You Page from Order Admin
    I’ve been testing for over an hour but finally I found a way to make this work. When you are in “Edit Order” view under WordPress Dashboard > WooCommerce > Orders, there is a dropdown of “Order actions”: “Email invoice“, “Resend new order notification“, etc. A major problem I’ve always had while troubleshooting or working […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *