• Hello,

    I have a small issue with the shipping method settings from the custom plugin.
    Normally the form looks like this:

    But after an upgrade to 7.4.0 the form looks like this:

    In fact this is the form that is displayed when the same shipping method is edited from inside the shipping zone.

    After investigation, I find that the culprit to this is:

    ~/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/Shipping/ShippingController.php

    If I add a condition to this function, not to load shipping zones when at the settings screen, then all is good. One sample is like this (at the start of the function):

    		if (is_admin() && isset($_GET['page']) && $_GET['page'] == 'wc-settings' && isset($_GET['tab']) && $_GET['tab'] == 'shipping' && isset($_GET['section']) && $_GET['section'] != '') {
    			return;
    		}
    

    So, there are 2 questions here:

    1. Why is this function call needed, when at the shipping settings screen?
    2. How can I guarantee, that “WC_Shipping_Method::init_form_fields()” returns the full form, if needed and not the shipping_zone specific form. Because this is not the firs time, third party plugins load shipping zones whereever they please and then ruin the main settings form because of it.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mhalmann

    (@mhalmann)

    Saif

    (@babylon1999)

    Hello @mhalmann,

    I’m not familiar with this table, are you using any of our shipping plugins like Table Rate Shipping ?

    Could you also share a copy of your site’s System Status? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.? Once you’ve done that, paste it here in your response.

    Look forward to hearing back from you.

    Thread Starter mhalmann

    (@mhalmann)

    This is my own shipping plugin, that displays global settings (large form) and shipping zone specific settings (small form). If you want to replicate this on your own, then make a shipping plugin, that has 2 different forms. (one global $this->form_fields and one shipping zone specific, $this->instance_form_fields). Then put on WooCommerce 7.4.0 and there it should be.

    The problem is that shipping zone specific settings are displayed in a place where the global settings should be displayed.

    From the stack trace I can see that my plugin is loaded first and then the “problem” steps in, which loads the shipping zones and “replaces” the form.

    ~/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/Shipping/ShippingController::hydrate_client_settings()

    Link to stack trace: https://snipboard.io/TqoNY4.jpg

    If I disable this “hydrate_client_settings()” then the issue is gone.

    I think this is outside the scope of site health itself. Somehow the properties of the shipping methods are cached in a place where they should not. I am looking a response from someone who is very familiar with the WooCommerce code.
    This is not the first time this issue has appeared. You used to have a “Wizard” that checks if the shipping methods are set up. This wizard called out the shipping zones same way as the current ShippingController and caused the exact same behaviour. Now it is just that, I am able to replicate the issue on my own machine, while previously only few customers got that behaviour.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shipping settings form reduced size after update to 7.4.0’ is closed to new replies.