C O D I T R O N

Technologies

Magento 2 Custom Shipping Rate Per Product And State-Wise Programmatically

By, Rahi Solanki
10 August 2022

This Magento 2 custom shipping rate extension will provide you customize shipping rates according to states per product. Using this extension admin can set different shipping rates for each product in the store, admin can charge separate shipping charges for each product in the cart during the checkout.

We will see more information about both the following methods:

  1. Shipping rate per product.
  2. State-wise shipping rate
Configuration:

To configure this feature you can go to Store->configuration->Sales->Delivery Methods-> Shipping per product.

  • Enabled: Set “YES” to enable shipping per product extension. 
  • Multiply Quantity: Charges sum of shipping rate per product in the order. 
  • Title: Enter the title for the shipping method. 
  • Shipping Rate: Select how you want to calculate the shipping rate. 
    • Per Product: Rate will be calculated product-wise.
  • Method Name: Enter the method name for the shipping method 
  • Price:  You can add the base shipping price.
  • Default Product Shipping Cost: Select “YES” to set the default shipping rate when unassigned to the individual product. 
  • Default Rate per Item: Enter the default shipping rate to charge per product 
  • Handling Fee: Add a handling fee if you want to apply on orders. 
  • Ship to applicable countries: Select all allowed countries to enable shipping per product for 
  • Ship to specific countries: Select countries to enable shipping per product. 
  • Displayed error message: A set error message to show for unavailability of the shipping method
  • Sort Order: Add the sort order of the method
Add Shipping rates to a specific product as per your requirement:

To add Shipping rate individually go to – catalog->Products  Select that product Then set Shipping Cost.

1) Shipping rate per product :

Features :
  • You can assign a specific shipping rate to the product you want.
  • If you have not assigned any shipping rate to the product, It will take the default shipping rate for that product.
  • Enable/Disable shipping for the product store-wise.
Before adding a custom shipping rate(Default Rate):

After adding a custom shipping rate:

Shipping as per product on cart page – per product – Sum of rates:

When you add the shipping method per product and the calculation method is set to multiply the quantity and if 2 quantities for 2 products with different individual shipping rates are added to the cart, the shipping rate is charged as shown below.

2) State-wise shipping rate

Features :

  • Apply custom rates for a specific state.
  • We have options to multiply the rate as per product quantity.
  • If two products are added it will take a higher shipping rate after calculating.

We can change the _id according to our needs:

Coditron Technologies

Contact Us

Address

Corporate Office : Greens Center, Thergaon Pune 411033

Operation Office: USA: PO Box # 582973 ElkGrove CA 95758