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

#   Shipping is calculated into total price but 0 in shipping method

##

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

Less More

- Posts: 175
- Thank you received: 0
-
-

9 years 2 months ago -  9 years 2 months ago [\#277098](#277098) by [veeco](/forum/user/18501-veeco "View veeco's Profile")  *[Shipping is calculated into total price but 0 in shipping method](/forum/28-shipping-methods/891719-shipping-is-calculated-into-total-price-but-0-in-shipping-method#277098 "-- HikaShop version -- : 2.6.4  Hello  i'm using my custom shipping method, the shipping value is calculated and added into the total price but somehow the shipping price is set to 0  Here is my code details  this is the result of var&#95;dump($rate)  and it works in front-end  however in the onShippingSave when i var&#95;dump($order)  The shipping price is turned into 0  The order recorded the selection but not the price, the email showing the order detail also didnt show shipping  Any suggestion how to fix this? Thank you  edit :  I used the same shipping method with different params in the backend turns out my code that nullify the shipping when it detected that the shipping is unavailable doesnt disable the shipping.  then i changed it to  to skip everything if the shipping method is not possible. I assume the shipping method will find the first shipping that it can find &#91;in this case, the 1st option isnt available, hence the shipping price is 0&#93;.  the shipping is now working but i will keep eye on it if there is another bug showed up")* was created by *[veeco](/forum/user/18501-veeco "View veeco's Profile")*

-- HikaShop version -- : 2.6.4

Hello

i'm using my custom shipping method, the shipping value is calculated and added into the total price but somehow the shipping price is set to 0

Here is my code details Code:

foreach($local_usable_rates as $k =&gt; $rate){ /*Calculating prince*/ $rate-&gt;shipping_price = $real_cost; $new_weight_volume = $totalweight." Kg"; $rate-&gt;shipping_description=" ".JText::_('JNE_TOTAL_BERAT')." : ".$new_weight_volume."&lt;br /&gt; ".JText::_('JNE_ESTIMASI_PENGIRIMAN')." : ".$real_etd." ".JText::_('JNE_HARI_KERJA')."&lt;br /&gt;"; $usable_rates[$rate-&gt;shipping_id]=$rate;//add shipping to tthe list }

this is the result of var_dump($rate) Code:

object(stdClass)#1537 (16) { ["shipping_id"]=&gt; string(2) "14" ["shipping_type"]=&gt; string(10) "rajaongkir" ["shipping_zone_namekey"]=&gt; string(0) "" ["shipping_tax_id"]=&gt; string(1) "0" ["shipping_price"]=&gt; int(113625) ["shipping_currency_id"]=&gt; int(75) ["shipping_name"]=&gt; string(24) "POS - Paket Kilat Khusus" ["shipping_description"]=&gt; string(73) " Total Weight / Volume : 3 Kg Shipment : 2-4 Days " ["shipping_published"]=&gt; string(1) "1" ["shipping_ordering"]=&gt; string(1) "5" ["shipping_currency"]=&gt; string(0) "" ["shipping_params"]=&gt; object(stdClass)#1546 (25) { ["shipping_percentage"]=&gt; string(1) "0" ["shipping_per_product"]=&gt; string(1) "0" ["shipping_price_per_product"]=&gt; string(0) "" ["shipping_override_address"]=&gt; string(1) "0" ["shipping_override_address_text"]=&gt; string(0) "" ["override_tax_zone"]=&gt; string(0) "" ["service_code"]=&gt; string(22) "pos&#124;Paket Kilat Khusus" ["origin_city"]=&gt; string(3) "151" ["shipping_warehouse_filter"]=&gt; string(0) "" ["shipping_min_price"]=&gt; string(1) "0" ["shipping_max_price"]=&gt; string(1) "0" ["shipping_virtual_included"]=&gt; string(1) "0" ["shipping_price_use_tax"]=&gt; string(1) "1" ["shipping_min_quantity"]=&gt; string(0) "" ["shipping_max_quantity"]=&gt; string(0) "" ["shipping_min_weight"]=&gt; string(1) "0" ["shipping_weight_unit"]=&gt; string(2) "kg" ["shipping_max_weight"]=&gt; string(1) "0" ["shipping_min_volume"]=&gt; string(1) "0" ["shipping_size_unit"]=&gt; string(1) "m" ["shipping_max_volume"]=&gt; string(1) "0" ["shipping_zip_prefix"]=&gt; string(0) "" ["shipping_min_zip"]=&gt; string(0) "" ["shipping_max_zip"]=&gt; string(0) "" ["shipping_zip_suffix"]=&gt; string(0) "" } ["shipping_images"]=&gt; string(0) "" ["shipping_access"]=&gt; string(3) "all" ["shippingkey"]=&gt; string(1) "0" ["shipping_currency_id_orig"]=&gt; string(1) "1" }

and it works in front-end

image missing http://imgur.com/D2cepxa.jpg
image missing http://imgur.com/hqmnTw5.jpg

however in the onShippingSave
when i var_dump($order)
Code:

array(1) { [0]=&gt; object(stdClass)#47 (19) { ["shipping_id"]=&gt; string(2) "14" ["shipping_type"]=&gt; string(10) "rajaongkir" ["shipping_zone_namekey"]=&gt; string(0) "" ["shipping_tax_id"]=&gt; string(1) "0" ["shipping_price"]=&gt; int(0) ["shipping_currency_id"]=&gt; int(75) ["shipping_name"]=&gt; string(24) "POS - Paket Kilat Khusus" ["shipping_description"]=&gt; string(73) " Total Weight / Volume : 5 Kg Shipment : 2-4 Days " ["shipping_published"]=&gt; string(1) "1" ["shipping_ordering"]=&gt; string(1) "5" ["shipping_currency"]=&gt; string(0) "" ["shipping_params"]=&gt; object(stdClass)#48 (25) { ["shipping_percentage"]=&gt; string(1) "0" ["shipping_per_product"]=&gt; string(1) "0" ["shipping_price_per_product"]=&gt; string(0) "" ["shipping_override_address"]=&gt; string(1) "0" ["shipping_override_address_text"]=&gt; string(0) "" ["override_tax_zone"]=&gt; string(0) "" ["service_code"]=&gt; string(22) "pos&#124;Paket Kilat Khusus" ["origin_city"]=&gt; string(3) "151" ["shipping_warehouse_filter"]=&gt; string(0) "" ["shipping_min_price"]=&gt; string(1) "0" ["shipping_max_price"]=&gt; string(1) "0" ["shipping_virtual_included"]=&gt; string(1) "0" ["shipping_price_use_tax"]=&gt; string(1) "1" ["shipping_min_quantity"]=&gt; string(0) "" ["shipping_max_quantity"]=&gt; string(0) "" ["shipping_min_weight"]=&gt; string(1) "0" ["shipping_weight_unit"]=&gt; string(2) "kg" ["shipping_max_weight"]=&gt; string(1) "0" ["shipping_min_volume"]=&gt; string(1) "0" ["shipping_size_unit"]=&gt; string(1) "m" ["shipping_max_volume"]=&gt; string(1) "0" ["shipping_zip_prefix"]=&gt; string(0) "" ["shipping_min_zip"]=&gt; string(0) "" ["shipping_max_zip"]=&gt; string(0) "" ["shipping_zip_suffix"]=&gt; string(0) "" } ["shipping_images"]=&gt; string(0) "" ["shipping_access"]=&gt; string(3) "all" ["shippingkey"]=&gt; string(1) "0" ["shipping_currency_id_orig"]=&gt; string(1) "1" ["shipping_warehouse_id"]=&gt; int(0) ["shipping_price_with_tax"]=&gt; int(0) ["shipping_price_orig_with_tax"]=&gt; NULL } }

The shipping price is turned into 0

image missing http://imgur.com/AAFUA4T.jpg

The order recorded the selection but not the price, the email showing the order detail also didnt show shipping

image missing http://imgur.com/gYhhxyp.jpg

Any suggestion how to fix this? Thank you

edit :

I used the same shipping method with different params in the backend
turns out my code that nullify the shipping when it detected that the shipping is unavailable doesnt disable the shipping.
Code:

$rate-&gt;shipping_published = 0; $order-&gt;shipping[0]-&gt;shipping_price_with_tax = 0; //this one that changed the price $order-&gt;shipping[0]-&gt;shipping_price = 0; //this one that changed the price $rate-&gt;shipping_description="Pengiriman Tidak Dapat Di lakukan";

then i changed it to
Code:

continue

to skip everything if the shipping method is not possible. I assume the shipping method will find the first shipping that it can find [in this case, the 1st option isnt available, hence the shipping price is 0].

the shipping is now working but i will keep eye on it if there is another bug showed up

Last edit: 9 years 2 months ago by [veeco](/forum/user/18501-veeco "View veeco's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI4LXNoaXBwaW5nLW1ldGhvZHMvODkxNzE5LXNoaXBwaW5nLWlzLWNhbGN1bGF0ZWQtaW50by10b3RhbC1wcmljZS1idXQtMC1pbi1zaGlwcGluZy1tZXRob2Q/dG1wbD1tYXJrZG93bg==) 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.101 seconds

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