Problem/Motivation

Other contrib modules should be able to alter definitions of ShippingMethods trough hook, rather then depending on the module weight.

use Drupal\commerce_currency_resolver\Plugin\Commerce\ShippingMethod\FlatRateCurrency;

/**
 * Implements hook_commerce_shipping_method_info_alter();
 */
function commerce_currency_resolver_commerce_shipping_method_info_alter(array &$definitions) {
  $definitions['flat_rate']['class'] = FlatRateCurrency::class;
}

Proposed resolution

Add alter 'commerce_shipping_method_info' to \Drupal\commerce_shipping\ShippingMethodManager

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

valic created an issue. See original summary.

valic’s picture

valic’s picture

Issue summary: View changes

  • bojanz committed 1bbe919 on 8.x-2.x authored by valic
    Issue #3082187 by valic: Allow altering definition of ShippingMethod...
bojanz’s picture

Status: Needs review » Fixed

Thanks! Every plugin type should always have an alter hook.

Status: Fixed » Closed (fixed)

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