[Skip to main content](#vessel-content)

#   set shipping percentage by weight

##

- **[mozgras](/forum/user/6398-mozgras "View mozgras's Profile")**
- [![mozgras's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6398-mozgras "View mozgras's Profile") Topic Author
- [ Offline](/forum/user/6398-mozgras)

Less More

- Posts: 13
- Thank you received: 1
-
-

14 years 8 months ago [\#42603](#42603) by [mozgras](/forum/user/6398-mozgras "View mozgras's Profile")  *[set shipping percentage by weight](/forum/4-how-to/42603-set-shipping-percentage-by-weight#42603 "I see how to set it up by % of the cost of the product, but can I set the shipping = weight &#42; value?")* was created by *[mozgras](/forum/user/6398-mozgras "View mozgras's Profile")*

I see how to set it up by % of the cost of the product, but can I set the shipping = weight * value?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQyNjAzLXNldC1zaGlwcGluZy1wZXJjZW50YWdlLWJ5LXdlaWdodD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14296
-
-

14 years 8 months ago [\#42739](#42739) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: set shipping percentage by weight](/forum/4-how-to/42603-set-shipping-percentage-by-weight#42739 "I see how to set it up by % of the cost of the product, but can I set the shipping = weight &#42; value?")*

You can't do that with the manual shipping plugin in HikaShop.
You can set it like that for example: from 0 to 1.5kg =&gt; $X, from 1.5 to 3.5kg =&gt; $Y
but you can't just set a percentage for it.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQyNjAzLXNldC1zaGlwcGluZy1wZXJjZW50YWdlLWJ5LXdlaWdodD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mozgras](/forum/user/6398-mozgras "View mozgras's Profile")**
- [![mozgras's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6398-mozgras "View mozgras's Profile") Topic Author
- [ Offline](/forum/user/6398-mozgras)

Less More

- Posts: 13
- Thank you received: 1
-
-

14 years 7 months ago -  14 years 7 months ago [\#42926](#42926) by [mozgras](/forum/user/6398-mozgras "View mozgras's Profile")  Replied by *[mozgras](/forum/user/6398-mozgras "View mozgras's Profile")* on topic *[Re: set shipping percentage by weight](/forum/4-how-to/42603-set-shipping-percentage-by-weight#42926 "I see how to set it up by % of the cost of the product, but can I set the shipping = weight &#42; value?")*

It would be a great feature, as shipping is often calculated by weight as opposed to price. I was trying to modify the plugin php - without modifying the front-end - by using the percentage field I thought I could make it work like this:
At line 59: Code:

$rates[$k]-&gt;shipping_price = round($rate-&gt;shipping_price + $price*$rate-&gt;shipping_params-&gt;shipping_percentage/100,$currencyClass-&gt;getRounding($rate-&gt;shipping_currency_id));

I tried substituting this line, but I'm not sure of the variables, and it doesn't work. Code:

$rates[$k]-&gt;shipping_price = round($rate-&gt;shipping_price + $rate-&gt;shipping_weight*$rate-&gt;shipping_params-&gt;shipping_percentage,$currencyClass-&gt;getRounding($rate-&gt;shipping_currency_id));

Do you have any suggestions here? Thanks.

Last edit: 14 years 7 months ago by [mozgras](/forum/user/6398-mozgras "View mozgras's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQyNjAzLXNldC1zaGlwcGluZy1wZXJjZW50YWdlLWJ5LXdlaWdodD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14296
-
-

14 years 7 months ago [\#43029](#43029) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: set shipping percentage by weight](/forum/4-how-to/42603-set-shipping-percentage-by-weight#43029 "I see how to set it up by % of the cost of the product, but can I set the shipping = weight &#42; value?")*

$rate-&gt;shipping_weight does not exists. The sum of the weight of the products in the cart is in the variable:
$order-&gt;weight

That should hopefully make it work like you want.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQyNjAzLXNldC1zaGlwcGluZy1wZXJjZW50YWdlLWJ5LXdlaWdodD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mozgras](/forum/user/6398-mozgras "View mozgras's Profile")**
- [![mozgras's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6398-mozgras "View mozgras's Profile") Topic Author
- [ Offline](/forum/user/6398-mozgras)

Less More

- Posts: 13
- Thank you received: 1
-
-

14 years 7 months ago [\#43083](#43083) by [mozgras](/forum/user/6398-mozgras "View mozgras's Profile")  Replied by *[mozgras](/forum/user/6398-mozgras "View mozgras's Profile")* on topic *[Re: set shipping percentage by weight](/forum/4-how-to/42603-set-shipping-percentage-by-weight#43083 "I see how to set it up by % of the cost of the product, but can I set the shipping = weight &#42; value?")*

Overall weight isn't great because I need the weight for each product, so that I can use that value to multiply by the value in the percentage field. Is there a way I can reference a product's weight and percentage value in the same bit of code? Thanks.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQyNjAzLXNldC1zaGlwcGluZy1wZXJjZW50YWdlLWJ5LXdlaWdodD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14296
-
-

14 years 7 months ago [\#43212](#43212) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: set shipping percentage by weight](/forum/4-how-to/42603-set-shipping-percentage-by-weight#43212 "I see how to set it up by % of the cost of the product, but can I set the shipping = weight &#42; value?")*

You can easily access the weight of each product with that piece of code:

foreach($order-&gt;products as $product){
echo $product-&gt;product_weight;
}

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQyNjAzLXNldC1zaGlwcGluZy1wZXJjZW50YWdlLWJ5LXdlaWdodD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mozgras](/forum/user/6398-mozgras "View mozgras's Profile")**
- [![mozgras's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6398-mozgras "View mozgras's Profile") Topic Author
- [ Offline](/forum/user/6398-mozgras)

Less More

- Posts: 13
- Thank you received: 1
-
-

14 years 7 months ago -  14 years 7 months ago [\#43227](#43227) by [mozgras](/forum/user/6398-mozgras "View mozgras's Profile")  Replied by *[mozgras](/forum/user/6398-mozgras "View mozgras's Profile")* on topic *[Re: set shipping percentage by weight](/forum/4-how-to/42603-set-shipping-percentage-by-weight#43227 "I see how to set it up by % of the cost of the product, but can I set the shipping = weight &#42; value?")*

Thanks for your help and responsiveness. I had to use -&gt;product_weight_orig. But I got it working with this code:

line 33: Code:

if(!empty($order-&gt;products)){ $copy = null; $product_count = 0; //Initialize count $copy-&gt;products = array(); foreach($order-&gt;products as $k =&gt; $row){ if($row-&gt;product_weight &gt; 0){ $copy-&gt;products[] = $row; // Get weight and quantity for each product $product_weight[$product_count] = $row-&gt;product_weight_orig; $product_quantity[$product_count] = $row-&gt;cart_product_total_quantity; $product_count++; }

And around line 65: Code:

if(isset($rate-&gt;shipping_params-&gt;shipping_percentage) &amp;&amp; bccomp($rate-&gt;shipping_params-&gt;shipping_percentage,0,3)){ $currencyClass = hikashop_get('class.currency'); //$rates[$k]-&gt;shipping_price = round($rate-&gt;shipping_price + $price*$rate-&gt;shipping_params-&gt;shipping_percentage/100,$currencyClass-&gt;getRounding($rate-&gt;shipping_currency_id)); //Set rate for each product $multiplier = $rate-&gt;shipping_params-&gt;shipping_percentage; for ($i=0;$i&lt;$product_count;$i++){ $rates[$k]-&gt;shipping_price = round($rates[$k]-&gt;shipping_price + $product_weight[$i]*$product_quantity[$i]*$multiplier,$currencyClass-&gt;getRounding($rate-&gt;shipping_currency_id)); } }

Last edit: 14 years 7 months ago by [mozgras](/forum/user/6398-mozgras "View mozgras's Profile"). Reason: code adjustment

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQyNjAzLXNldC1zaGlwcGluZy1wZXJjZW50YWdlLWJ5LXdlaWdodD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mozgras](/forum/user/6398-mozgras "View mozgras's Profile")**
- [![mozgras's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6398-mozgras "View mozgras's Profile") Topic Author
- [ Offline](/forum/user/6398-mozgras)

Less More

- Posts: 13
- Thank you received: 1
-
-

13 years 9 months ago -  13 years 9 months ago [\#88273](#88273) by [mozgras](/forum/user/6398-mozgras "View mozgras's Profile")  Replied by *[mozgras](/forum/user/6398-mozgras "View mozgras's Profile")* on topic *[Re: set shipping percentage by weight](/forum/4-how-to/42603-set-shipping-percentage-by-weight#88273 "I see how to set it up by % of the cost of the product, but can I set the shipping = weight &#42; value?")*

Make edits to these files:
/plugins/hikashopshipping/manual/manual.php
/administrator/components/com_hikashop/extensions/plg_hikashopshipping_manual/manual.php

Last edit: 13 years 9 months ago by [mozgras](/forum/user/6398-mozgras "View mozgras's Profile"). Reason: solved issue

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQyNjAzLXNldC1zaGlwcGluZy1wZXJjZW50YWdlLWJ5LXdlaWdodD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.054 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
