I ran into an issue where I couldn't activate the plugin in the Shipping Method form.

The following error would be logged, and the plugin form would not load:

Ein AJAX-HTTP-Error occured.
HTTP-Code: 200
Path: /admin/commerce/config/shipping-methods/add?ajax_form=1
Status: OK
Response: TypeError: Return value of Drupal\commerce_shipping\ShippingService::getLabel() must be of the type string, null returned in Drupal\commerce_shipping\ShippingService->getLabel() (line 54 of /Users/xx/xx/xx/xx/modules/contrib/commerce_shipping/src/ShippingService.php)."

I compared the FlatRate class of the Commerce_Shipping plugin to the ShippingByWeight class and noticed that the 'rate_label' in defaultConfiguration() was set to NULL instead of an empty string as in the FlatRate class.
Changing the default to an empty string fixed the error response.

Attached is the Patch in question.

Cheers!

CommentFileSizeAuthor
defaultConfigurationDefaultLabel.patch631 bytesmotioneer
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

motioneer created an issue. See original summary.

ysamoylenko’s picture

Hello @motioneer,

The issue is already fixed by patch #3 from the page #3109850: Update for Shipping 2.x-dev (post-beta8).

Thank you for the report.

ysamoylenko’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.