SwissUpLabs Logo

Housenumber

This feature supported since v.1.12.0

  1. Create custom.js file in your active theme with following content:

    define([
        'Swissup_Firecheckout/js/utils/form-field/manager',
        'Swissup_Firecheckout/js/utils/form-field/classname',
        'mage/translate'
    ], function (manager, classname, $t) {
        'use strict';
    
        classname('.street', 'fc-col-12');
        classname('[name="street[0]"]', 'fc-col-8 fc-size-s:fc-col-6 fc-size-xs:fc-col-12');
        manager('[name="street[1]"]', {
            label: 'Housenumber',
            placeholder: 'Housenumber',
            classname: 'fc-col-4 fc-size-s:fc-col-6 fc-size-xs:fc-col-12',
            validator: {
                'lazy': true,
                'required': true,
                'fc-custom-rule-housenumber': {
                    handler: function (value) {
                        return new RegExp(/^\d+[a-zA-Z]?$/).test(value);
                    },
                    message: $t('Invalid housenumber. Valid examples: 42, 3A, 18C')
                }
            }
        });
    });
    
  2. Run “Deploy static content” command:

    cd <magento_root>
    
    # remove previously deployed firecheckout files
    find pub/static -type d -regex ".*Firecheckout.*js" -exec rm -rf {} \;
    
    # run deployment command
    bin/magento setup:static-content:deploy
    

Result

Housenumber

Next up
Edit this Page