Joomla VirtueMart: Set Shipping per Item

While working with VirtueMart on Joomla, I realised that the Shipping cost is calculated as a whole. What I needed was to have the same shipping cost for every item. So Here how it goes..

Modifying the shipping file to set shipping per item:

  • First thing we need to do it access the ftp account where all the files are stored.
  • Onces accessed the ftp account, copy and paste the link below:

ftp.youDomain.com/leatherhouse/administrator/components/com_virtuemart/classes/shipping/

  • Lookup the file standard_shipping.php, and open it on a notepad.
  • use the ctrl + F to find the following text: $total_shipping_handling =
  • There should be 3 lines starting with $total_shipping_handling, so under  those 3 lines paste the following line:

$total_shipping_handling = $d[“zone_qty”] * $dbr->f( “shipping_rate_value” ) + $dbr->f( “shipping_rate_package_fee” ) ;

If you want to add extra fixed charge per item a basic fee

example: (3 items x 2.00 euro) plus a basic shipping fee of 5 euro which would add up to 11 euro

OR paste the following:

$total_shipping_handling = $d[“zone_qty”] * $dbr->f( “shipping_rate_value” );

If you simply want to make one single cost per item

example: 3 items for 4 euro each which add up to 12 euro in total.

  • So your code in the file should look something like:
$total_shipping_handling = $dbr->f( "shipping_rate_value" ) + $dbr->f( "shipping_rate_package_fee" ) ;
$total_shipping_handling = $GLOBALS['CURRENCY']->convert( $total_shipping_handling, $shipping_rate_currency_code, $GLOBALS ['product_currency'] ) ;
$total_shipping_handling *= $taxrate ;
$total_shipping_handling = $d["zone_qty"] * $dbr->f( "shipping_rate_value" );
$show_shipping_handling = $CURRENCY_DISPLAY->getFullValue( $total_shipping_handling ) ;

Setting the Actual Shipping Rate per Item:

  • First thing we need to do, is to configure the shipping option from:
    • Components — VirtueMart
    • Admin — Configuration —- Shipping
    • Check ONLY:

“Standard Shipping module with individual configured carriers and rates. RECOMMENDED !”

  • Access the Shipping Settings
  • Create a Shipping Rate and fill in details. It should look something like this:
Fee : represents the amount added to each item in shopping cart
Your Package fee : represents the basic amount of cost irrelevance to the quantity
first formula would suggest that: Total Shipping = (Quantity * Fee) + Your Package Fee
second formula suggests that: Total Shipping = Quantity * Fee (does not need Your Package Fee)

Goodluck and enjoy  😉

12 thoughts on “Joomla VirtueMart: Set Shipping per Item

  1. Hi Rochcass,

    Pretty nifty trick. Forgive me for being a moocher, but do you know of any way to create a radiobutton during the “order flow” that would allow a person to select lets say a) local fee $5 b) long-distance fee – $10 and have that specific fee added to the overall total?

    Any tips would be greatly appreciated.

    • I wouldn’t suggest that you allow the client to tick the radio button for long/ short distance as it is most probably they will always select the cheapest one. However there is an option that allows you to calculate shipping (if its that what you are referring to if i understood you well) according to the distance given from the clients address. A fixed fee can be still kept for all and additional charges may be added according locality / country shipping to. If thats what you need, I would be glad to help out step by step.

      Goodluck

  2. Thanks for posting this – I needed something similar for one of my sites. I changed it slightly because I needed a maximum amount, so I added:

    if ( $total_shipping_handling > 6.99 ) {
    $total_shipping_handling = 6.99;
    }

  3. This did not work for me in my version of vm so i did this i removed :-
    $total_shipping_handling = $dbr->f( “shipping_rate_value” ) + $dbr->f( “shipping_rate_package_fee” ) ;

    and added

    $total_shipping_handling = $d[“zone_qty”] * $dbr->f( “shipping_rate_value” ) + $dbr->f( “shipping_rate_package_fee” ) ;

    This worked for my vm

  4. i have used virtuemart 2.0.12b version i didn’t find this path in my vituemart.
    administrator/components/com_virtuemart/classes/shipping/

    Please help me i also want to update my shipping price based on per product.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s