Magento 2 Custom Shipping Attributes

Table of Contents

  1. Extension Installation
  2. Configuration
  3. Configure Custom Shipping Method
  4. Manage Shipping Attributes
  5. Custom Shipping Attributes in Frontend
  6. Custom Shipping Attributes in Sales Order View in Backend

 

 

 

  1. Extension Installation
  • For Magento Marketplace Customers
    • Find the Composer name and version of the extension in the extension’s composer.json file.
    • Login to your SSH and run:
    • composer require meetanshi/magento-2-custom-shipping-attributes
    • Enter your authentication keys. Your public key is your username; your private key is your password.
    • Wait for Composer to finish updating your project dependencies and make sure there aren’t any errors.
    • To verify that the extension installed properly, run the command:
      • php bin/magento module:status Meetanshi_CustomShippingOptions
          • By default, the extension is probably disabled.
          • Enable the extension and clear static view files:
      • php bin/magento module:enable Meetanshi_CustomShippingOptions --clear-static-content
      • php bin/magento setup:upgrade
      • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
      • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
      • php bin/magento cache:flush
         
  • For Meetanshi Customers
  • Extract the zip folder and upload our extension to the root of your Magento 2 directory via FTP.
  • Login to your SSH and run below commands step by step:
  • php bin/magento setup:upgrade
  • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
  • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
  • php bin/magento cache:flush
  1. Configuration
    To configure the extension, login to Magento 2, move to Stores à Configuration à Custom Shipping Attributes where you can find various settings to configure the extension.
  • Custom Shipping Attributes: Enable custom shipping attributes extension from here.

 

 

  1. Configure Custom Shipping Method
    Immediately after the extension installation, you can see a custom shipping method added at Stores > Configuration > Sales > Shipping Methods > Meetanshi Custom Shipping Method. You can configure title, method name, shipping rate, handling fee, allowed countries, etc. for the same. Custom shipping attributes are compatible only with this custom shipping method you configure.

 

  1. Manage Shipping Attributes

All the created and stored custom shipping attributes are stored at Sales > Meetanshi Custom Shipping Attributes > Manage Shipping Attributes grid. The admin can use enable, disable and delete mass action for the custom shipping attributes.

 

  • Add New Custom Shipping Attribute
    From the Manage Shipping Attributes grid, click on “Add New Shipping Attribute” button to add a custom shipping attribute.
    • Enable: Select to enable custom shipping attribute.
    • Label: Enter label of the custom shipping attribute.
    • Code: Enter code for the unique identification of the attribute.
    • Shipping Attribute Input Type: Select one of the shipping attribute input types.
      • Text Field
      • Text Area
      • Yes/No
      • Multi Select
      • Dropdown
      • Date Picker
    • Default Value: Set default value for the above selected shipping attribute input type.
    • Attribute Value Input Required: Select YES to mandate attribute value input from the customers at the time of using custom shipping method.

 

 

  1. Custom Shipping Attributes in Frontend
    Once the extension is configured and enabled, customers can see custom shipping attributes at the time of opting for the custom shipping method. If the Attribute Value Input Required option is set to YES, customer has to input the value to checkout the product and place order successfully.

 

  • Custom Shipping Attribute Details in Customer’s My Account Section
    Immediately after the order is placed successfully, custom shipping attributes selected by the customer is displayed in order view section in My Account section.



     
  1. Custom Shipping Attributes in Sales Order View in Backend

Apart from the customers, the admin can also see custom shipping attributes selected by the customers from Sales > Orders > Order View section in the backend.

 

  1. Custom Shipping Attributes in Order Confirmation Email to Customers
    After the successful order placement, customer can see selected shipping attributes in order confirmation email under the custom shipping options section.