Open luzat opened 3 years ago
Same here! But I face this issue, when initially enter API key on new install.
Yes I know. We previously had this update upon entering and saving the form. Unfortunately Wordpress always loads the shipping method (multiple times), resulting in multiple calls to the API, which is unnecessary and can get people to reach their request limits. Therefore you currently have to save your settings one more time after entering the API key for them to be loaded.
Unfortunately this "...save your settings one more time after entering the API key..." doesn't work either.
For me, the carriers do display in settings, but not when editing shipping methods, which is because $this->carriers
is only initialized in this code path:
if ( wcsc_is_settings_screen() ) {
if ( ! $this->init_settings_screen() ) {
return false;
}
}
Given that shipping methods are not edited on the shipcloud settings screen, $this->carriers
is always going to be []
.
Hmm, ok interesting. Will have to have a look at that.
When editing shipping methods, there are none shown:
The problem seems to be one of the following two, not sure which one:
WC_Shipcloud_Shipping::carriers
is only initialized for the settings screen ininit_settings_screen
and thus is not available ininit_settings_fields
to in turn initialize$carriers_options
for use ininstance_form_fields
'allowed_carriers
field:allowed_carriers
should actually be initialized fromavailable_carriers
here?Another thing that I noticed is, that
WC_Shipcloud_Shipping::init_allowed_carriers
does not initialize anything. Isn't it meant to at least assignallowed_carriers
to some instance variable? Instead it seems that most methods seem to do this on their own. It's at least a misnomer.