Magento 2 Matrix Rates

Magento 2 Matrix Rates helps store owner to offer and charge custom shipping rates based on shipping locations, product weight, price, and quantity.

Table of Content

  1. Extension Installation Guide
  2. Add Method to Import Matrix Rates
  3. Configuration
  4. Create Shipping Types Options
  5. Matrix Rates in Frontend
  6. Matrix Rates in Backend

 

  1. Extension Installation
  • 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
  • That’s it.

 

  1. Add Method to Import Matrix Rates
    To import Matrix Rates, go to Sales > Matrix Rates and add method from the “Add Method” button.


 

  • Add New Rate to Import Matrix Rates
    Configure the shipping method to add new shipping rates.
    • Name: Add a name for the matrix rate method. Set {day} variable to show estimated delivery days along with the method name in frontend.
    • Status: Set the status of the matrix rate as “Active” from here.
    • Priority: Set priority for the method.
    • For Products with Different Shipping Types:
      • Sum Up Rates: Shipping rates of all the products get summed up and charged.
      • Select Maximal Rate: Shipping rate of the product with the maximum amount gets charged.
      • Select Minimal Rate: Shipping rate of the product with the minimum amount gets charged.
    • Stores: Select the store view for the matrix rate method.
    • Customer Groups: Select customer groups to assign the method.



 

  • Import Matrix Rates
    Import Matrix Rates using CSV from the Import tab in Matrix Rate Methods.
    • Delete Existing Rates: All the existing rates will be removed when you try to save changes or import CSV with rates.
    • CSV File: Upload a CSV file with Matrix rates in proper formatting.


 

The sample CSV for the matrix rates has the format shown below:

Sample CSV with Postal Codes of UK:

 

Sample CSV with Postal Codes of US:

 

  • Methods and Rates
    To view the imported Matrix Rates, navigate to “Methods and Rates tab” as shown below. Here’s what each grid column means:
    • Country: Shows the country for which the rate will be applied.
    • State – Shows the state for which the rate will be applied.
    • Zip From - To – Indicates a specific postcode range. When it's filled like 'From: 20001 To: 30000' the rate will apply for all 1000 postcodes inside the 20001 - 30000 range. The UK postcode format is supported.
    • Price From - To – Indicates the prices for products with the same shipping type will be summarized.
    • Weight From - To - The same condition as above but for the weight attribute of the product.
    • Qty From - To - same as above but for the quantity in the shopping cart.
    • Shipping Type – All means the rate will be applied to all the products.
    • Rate – The applicable rate amount for the whole order.
    • PPP - Percentage per Product Price. Shipping will be calculated as a percentage of the product price.
    • FRPP - Indicates Fixed Rate Per Product Price. Shipping will be calculated multiplying product quantity in the cart by the value in the FRPP field.
    • FRPUW - Indicates the Fixed Rate Per Unit of Weight. The rate will be calculated based on the weight of the product. For example, if FRPUW is set to 3.25 and Weight of the product in the cart is 4.25 then the calculation will be like this: 3.25*4.25=$13.81
    • Estimated Delivery (days) – Specifies the estimated delivery days for the shipping method. The days here will be inserted in the {day} variable which you can use in the Name field.


  

  1. Configuration
    For configuring the extension, login to Magento 2, move to Stores  > Configuration > Sales > Shipping Methods > Matrix Rates where you can find various settings to configure the extension.
  • Enabled for Checkout: Set YES to enable Matrix Rates.
  • Title: Enter the title of the shipping method.
  • Ship to Applicable Countries: Select countries to allow use of the shipping method.
  • Displayed Error Message: Enter error message for shipping unavailability.
  • Allow Free Shipping Promotions: Select YES to allow free shipping rule from shopping cart price will be applied.
  • Ignore Price and Quantity of Virtual Products: Select YES to ignore price and quantity of virtual products while calculating shipping.
  • Numeric Zip: Set YES to allow numeric zip codes in CSV.
  • Use price AFTER discount: Set YES to use price after deducting discount while shipping rates calculation.
  • Use price INCLUDING tax: Set YES to use price inclusive of tax while calculating shipping rates.
  • Use only one shipping type for shipping method: When set to YES, if the shopping cart is having products with different Shipping Types, the rate with 'Shipping Types = All' will be applied instead.
  • Sort Order: Set sort order of the shipping method to show in frontend.


 

  1. Create Shipping Types Options
  • Create Shipping Type Attribute Options
    To create the options for ‘shipping type’ attribute please go to Catalog > Products > Attributes Action > Edit Product Attribute "Shipping Type“ > Manage Label/Options.


  

  • Shipping Types Options
    Navigate to Properties tab in the Attribute Information menu. As shown below, click the “Add Option” button to add shipping type options.


 

  • Assign Shipping Type to Product
    Once the shipping options are created, assign value of the attribute to the product to calculate matrix rates based on.


  

  1. Matrix Rates in Frontend
    Once the settings are configured, add a product to cart to see Matrix Rates shipping method enabled in the frontend.
  • Matrix Rates on Cart Page
    When a customer adds products to cart and proceeds to make the payment, the Matrix Rates is displayed on Cart Page along with the delivery days if added along with the shipping rates in CSV.


  

  • Matrix Rates on Checkout Page
    Check the Matrix Rates details in order summary as shown below.


 

  • Matrix Rates in My Account Page
    As shown below, the Matrix Rates method name is displayed in My Accounts page from the “My Orders” menu.


  

  1. Matrix Rates in Backend
    The Matrix Rates method name and estimated delivery days can be viewed from the Sales Order View backend as shown here.