I am trying to create a simple modification that will remove a specific shipping method from the list when the customers country is not US.
I have test it the code directly into app/tygh/shippings.php and it works perfect.
Code inside function getShippingsList in file shippings.php
if ($group["package_info_full"]["location"]["country"] == "US"){ unset($shippings_info[1]); }
The problem is when i created this as an addon. The value 1 in shippings_info array is not removed.
Addon Code:
File init.php
File Func.php
function fn_w2g_mod_shipping_shippings_get_shippings_list_post($group, $lang, $area, $shippings_info){
if ($group["package_info_full"]["location"]["country"] == "US"){
unset($shippings_info[1]);
}
}
?>
The addon works and i can installed though admin.
Also when i print out the $shippings_info array inside the hook function the shipping method has been removed.
But it continues to show the shipping method at the checkout page.
Thank you for your time