• Resolved joonbizzle

    (@joonbizzle)


    When updating a shipping zone, I get the following error message with no settings being saved:

    {"code":"bad_form_data","message":"Unable to update service settings. The form data could not be read.","data":{"status":400}}

    The form values I’m using are:

    SETUP

    • Shipping method title: USPS
    • Origin zip code: 10007

    RATES > SERVICES

    • Priority Mail
    • Priority Mail – Large Flat Rate Box (12x12x5)
    • Priority Mail – Large Flat Rate Box (23x11x3)
    • Priority Mail – Medium Flat Rate Box (Top Loading)
    • Priority Mail – Medium Flat Rate Box (Side Loading)
    • Priority Mail – Small Flat Rate Box

    OTHER RATE SETTINGS

    • Show all available rates and let customers choose
    • Fallback Rate (in $) = 5.75
    • Commercial – Discounted post office rates

    PACKAGING: When cheaper, pack multiple items in a single package.

    PLUGIN VERSIONS

    • WooCommerce 2.6.14
    • WooCommerce Services 1.1.1
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Jeff Stieler

    (@jeffstieler)

    Hi @joonbizzle!

    Thanks for taking the time to write up the issue you’ve encountered (and with such detail)!

    The error you’re experiencing points to an issue reading some JSON-encoded data communicated between different parts of the plugin. If you’re comfortable with code, you can see the relevant line here.

    Unfortunately, I was unable to reproduce the error on my Macbook using Chrome (and the same data you’re attempting to submit).

    Because the error is preventing the plugin from contacting our servers, we don’t have much insight. Are you willing to provide us with some more information about your browser and server setup?

    Things that can help diagnose the issue are:

    • Operating System (Mac OS 10.12.1, Windows 10.0.10240.17202)
    • Browser (Microsoft Edge 38.14393.0.0)
    • Console errors (if you are comfortable opening Developer Tools)
    • Server PHP version – you can ask your webhost for this

    Thanks again for writing in, and hopefully we can get to the bottom of this!

    Thread Starter joonbizzle

    (@joonbizzle)

    Thanks for the quick response and ideas, @jeffstieler.

    TL;DR: I had only one moment of success but was short lived and I couldn’t replicate that success again. It was related to the “Jetpack by WordPress.com” plugin and WordPress.com user account token connection to that plugin.

    Apologies in advance for length of this reply but it might be useful and/or save others the pain of going through the same process.

    ###

    Server PHP Version: 5.4

    I get the aforementioned error in these scenarios:

    Mac OS 10.10.5

    • Firefox 51.0.1
    • Chrome 56.0.2924.87
    • Safari 10.0.3 (10602.4.8.0.1)

    Windows 10 Pro Version 1511

    • Firefox 51.0.1
    • Chrome 56.0.2924.87
    • MS Edge 38.14393.0.0

    Windows 7 Professional SP1

    • Firefox 51.0.1
    • Chrome 56.0.2924.87

    The zone settings form doesn’t display in these scenarios:

    Windows 10 Pro Version 1511

    • MS Internet Explorer 11.576.14393.0

    Windows 7 Professional SP1

    • MS Internet Explorer 11.0.9600.18537

    I also went to WooCommerce > Systems Status > WooCommerce Services and also saw nothing under this tab.

    ###

    When checking Firebug, I saw this error in the console:

    "NetworkError: 400 Bad Request - https://mydomain.com/wp-json/wc/v1/connect/services/usps/5"

    And retrieved this JSON put:

    {
    	"title": "USPS",
    	"account_id": "",
    	"origin": "10007",
    	"services": {
    		"pri": {
    			"id": "pri",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_flat_env": {
    			"id": "pri_flat_env",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_large_flat_box": {
    			"id": "pri_large_flat_box",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_large_flat_box_2": {
    			"id": "pri_large_flat_box_2",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_legal_flat_env": {
    			"id": "pri_legal_flat_env",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_medium_flat_box_top": {
    			"id": "pri_medium_flat_box_top",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_medium_flat_box_side": {
    			"id": "pri_medium_flat_box_side",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_sm_flat_box": {
    			"id": "pri_sm_flat_box",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_padded_flat_env": {
    			"id": "pri_padded_flat_env",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_small_flat_env": {
    			"id": "pri_small_flat_env",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_window_flat": {
    			"id": "pri_window_flat",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_regional_a1": {
    			"id": "pri_regional_a1",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_regional_a2": {
    			"id": "pri_regional_a2",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_regional_b1": {
    			"id": "pri_regional_b1",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_regional_b2": {
    			"id": "pri_regional_b2",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_exp": {
    			"id": "pri_exp",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_exp_flat_env": {
    			"id": "pri_exp_flat_env",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_exp_legal_flat_env": {
    			"id": "pri_exp_legal_flat_env",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_exp_padded_flat_env": {
    			"id": "pri_exp_padded_flat_env",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"first_class_stamped": {
    			"id": "first_class_stamped",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"first_class_metered": {
    			"id": "first_class_metered",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"first_class_parcel": {
    			"id": "first_class_parcel",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"first_class_lg_postcard": {
    			"id": "first_class_lg_postcard",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"first_class_postcard": {
    			"id": "first_class_postcard",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"first_class_lg_env_flat": {
    			"id": "first_class_lg_env_flat",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"first_class_package": {
    			"id": "first_class_package",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"retail_ground": {
    			"id": "retail_ground",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"media": {
    			"id": "media",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"library": {
    			"id": "library",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"gxg": {
    			"id": "gxg",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_exp_intl": {
    			"id": "pri_exp_intl",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_exp_intl_env_flat": {
    			"id": "pri_exp_intl_env_flat",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_exp_intl_legal_flat": {
    			"id": "pri_exp_intl_legal_flat",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_exp_intl_padded_flat": {
    			"id": "pri_exp_intl_padded_flat",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_intl": {
    			"id": "pri_intl",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_intl_lg_box": {
    			"id": "pri_intl_lg_box",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_intl_md_box_top": {
    			"id": "pri_intl_md_box_top",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_intl_md_box_side": {
    			"id": "pri_intl_md_box_side",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_intl_sm_box": {
    			"id": "pri_intl_sm_box",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_intl_env_flat": {
    			"id": "pri_intl_env_flat",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_intl_legal_flat": {
    			"id": "pri_intl_legal_flat",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_intl_padded_flat": {
    			"id": "pri_intl_padded_flat",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_intl_sm_env_flat": {
    			"id": "pri_intl_sm_env_flat",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"pri_intl_window_flat": {
    			"id": "pri_intl_window_flat",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"first_class_intl": {
    			"id": "first_class_intl",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		},
    		"first_class_intl_lg_env": {
    			"id": "first_class_intl_lg_env",
    			"enabled": false,
    			"adjustment": 0,
    			"adjustment_type": "flat"
    		}
    	},
    	"fallback_rate": 0,
    	"rate_filter": "all",
    	"rate_class": "retail",
    	"packing_method": "by_price"
    }

    ###

    I set both WP_DEBUG and FORCE_SSL_ADMIN to both “true” and “false” and alternating values with the same result.

    I switched themes to “Twenty Seventeen” with the same result.

    I turned off plugins one-by-one until I got to “Jetpack by WordPress.com,” which gave me a surprising and welcomed error message, after I reactivated it and reconnected my WordPress.com account:

    “There was a problem with one or more entries. Please fix the errors below and try saving again.”

    Unfortunately, I did not capture the JSON put in this success scenario and the happy editing of the form didn’t last long. In less than a couple minutes, another error message indicated that I wasn’t connected to Jetpack, when the plugin seemed to indicate that I still was:

    “Unable to send request to WooCommerce Services server. Jetpack Token is missing”

    Thinking that I could simply disconnect and then reconnect my WordPress.com account without deactivating/reactivating Jetpack didn’t go over well. I was met with this error:

    “Invalid request, please go back and try again.
    Error Code: invalid_client
    Error Message: Unknown client_id.”

    Even after clearing my cookies, the error message came up again. It wasn’t until I actually deactivated/reactivated Jetpack that I was finally able to reconnect to my WordPress.com account.

    After all that, I saw this again in the shipping zones form, when I tried to submit changes:

    {"code":"bad_form_data","message":"Unable to update service settings. The form data could not be read.","data":{"status":400}}

    Plugin Contributor Jeff Stieler

    (@jeffstieler)

    Thanks again for the detail you put into your responses @joonbizzle!

    The next release of the plugin will include more information related to JSON parsing errors, depending on your PHP version. (5.3+ will include a numeric JSON error code)

    The error you’re experience is curious though, because the JSON you’ve included here appears to be valid.

    Hopefully with the new error resolution, we’ll get to the bottom of this! Thanks again.

    Plugin Contributor Jeff Stieler

    (@jeffstieler)

    Hello again @joonbizzle, thanks for hanging in there!

    Version 1.2.0 of the plugin has been released, and amongst other things – contains more detailed JSON error debugging information. Please update as soon as it’s convenient.

    Plugin Contributor Jeff Stieler

    (@jeffstieler)

    I’m marking this as resolved for now. If you experience the error again, don’t hesitate to reopen this issue, or create a new one.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Shipping Zones Not Being Accepted’ is closed to new replies.