Jump to content

PS 1.6.1.17 Custom Module to change Shipping Cost


Recommended Posts

Hi,

I have created a module so that I can with hooks to change the shipping cost. I post the code 

 

public function hookDisplayBeforeCarrier($params) 
    {
        $delivery_option_list = $params['delivery_option_list'];
        foreach($delivery_option_list as $id_address => $carrier_list_raw) {
           foreach($carrier_list_raw as $key => $carrier_list) {
                foreach($carrier_list['carrier_list'] as $id_carrier => $carrier) {
                    $delivery_option_list[$id_address][$key]['total_price_with_tax'] = 2;
                }
           }
        }

        $this->context->smarty->tpl_vars["delivery_option_list"]->value = $delivery_option_list;
    }

This is a hook function which trigger on show the list of shipping options. I want to set directly all shipping optiosn to have price 2. But unfortunately this does not work although this function runs. Can please someone support ?

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...