Support » Plugin: WooCommerce » Adding a section to the WooCommerce settings ‘Shipping’ tab

  • Resolved ericgf


    Your article on “Adding a Section to Settings Tab” (located here: Adding a section to WooCommerce settings tab ) is excellent and easy to follow. It shows how to add a custom section in the WooCommerce Settings -> Products tab. It also explains that you can add custom sections to other tabs by using the appropriate filter name.

    However, this does not appear to work if you add the custom section under the “Shipping” tab
    The sample wcslider code includes;
    add_filter( 'woocommerce_get_sections_products', 'wcslider_add_section' );
    I changed to:
    add_filter( 'woocommerce_get_sections_shipping', 'wcslider_add_section' );
    and ;
    add_filter( 'woocommerce_get_settings_products', 'wcslider_all_settings', 10, 2 );
    I changed to:
    add_filter( 'woocommerce_get_settings_shipping', 'wcslider_all_settings', 10, 2 );
    With these two minor changes to the sample wcslider code provided in the article I had the custom section appear under the “Shipping” tab, but when clicked it appears blank. Only a “Save Settings” button appears and no settings.
    Is this a bug in WooCommerce?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Rynald0s.a11n


    Automattic Happiness Engineer

    Hi, @ericgf!

    So, you can add to the shipping settings subtab only — not directly using woocommerce_get_sections_shipping

    You’ll need to drop the add_filter( 'woocommerce_get_sections_shipping', 'wcslider_add_section' ); function and rework it using only add_filter( 'woocommerce_get_settings_shipping', 'wcslider_all_settings', 10, 2 );


    Plugin Support Rynald0s.a11n


    Automattic Happiness Engineer


    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please start a new thread.


    The linked article states:

    When creating an extension for WooCommerce, think about where your settings belong before you create them. The key to building a useful product is making it easy to use for the end user, so appropriate setting placement is crucially important.

    It’s not clear why this restriction exists?

    I’m writing a plugin that assists in backend shipping fulfilment – its options should be a section under the Shipping tab. Instead, my options are to place it as a heading under ‘shipping options’ (where it will be buried), or create a fresh tab (overkill).

    Can we please get the linked docs page updated? This statement:

    The important thing about the woocommerce_get_sections_products filter, is that the last part products, is the tab you’d like to add a section to. So if you want to add a new tab to accounts section, you would hook into the woocommerce_get_sections_accounts filter.

    needs a disclaimer to indicate that woocommerce_get_sections_shipping is not a hook that the user should use, as the corresponding woocommerce_get_setting_shipping does not get called anywhere except on the shipping options section. Reading the source of class-wc-settings-shipping.php I think I can see why (sections under Shipping are reserved for options registered by different shipping methods?). But the docs should say so.

    • This reply was modified 3 years, 1 month ago by hughc. Reason: cleaned up language
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding a section to the WooCommerce settings ‘Shipping’ tab’ is closed to new replies.