Skip to content

Temando_Shipping maps and rewrites core js files even if not enabled as shipping method #15968

@speedupmate

Description

@speedupmate

Temando_Shipping extension that is included by default in Magento2 maps following paths in requirejs-config.js

var config = {
    paths: {
        temandoCheckoutFieldsDefinition: 'Temando_Shipping/js/model/fields-definition',
        temandoCustomerAddressRateProcessor: 'Temando_Shipping/js/model/shipping-rate-processor/customer-address',
        temandoNewAddressRateProcessor: 'Temando_Shipping/js/model/shipping-rate-processor/new-address',
        temandoShippingRatesValidator: 'Temando_Shipping/js/model/shipping-rates-validator/temando',
        temandoShippingRatesValidationRules: 'Temando_Shipping/js/model/shipping-rates-validation-rules/temando'
    },
    map: {
        'Magento_Checkout/js/model/shipping-rate-service': {
            'Magento_Checkout/js/model/shipping-rate-processor/customer-address' : 'temandoCustomerAddressRateProcessor',
            'Magento_Checkout/js/model/shipping-rate-processor/new-address' : 'temandoNewAddressRateProcessor'
        }
    }
};

this is included in all cases, if extension is configured to be actually used or just free-rides as a default enabled module after installation . So by purely existing in the system it affects core behaviour.

Preconditions

  1. Magento 2.2.4 with demo data
  2. Temando_Shipping extension enabled by default but not configured as shipping method

Steps to reproduce

  1. On clean installation m2.2.4 with demo data
  2. add stuff to cart and reach checkout
  3. Temando_Shipping has mapped over some core js files even if not configured as a shipping method

Expected result

  1. No inclusion of what so ever Temando_Shipping as it is not enabled as a shipping method and has no legit reason to affect core functionality
  2. even if included it should not redefine core functionality if method is not configured

Actual result

  1. Core js fiels are mapped and core behaviour is changed (how exactly it f*s up the defaults is currently not important)

ways to fix

  1. use mixins instead mapping
  2. since m2 lacks a way to tie requirejs-config rules to be applied/tied to additional configuration rules (by admin config values / layout rules) validate the need of a mixin inside each method affected inside mixin
  3. if no legit need for affecting behaviour return a default behaviour

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions