Jump to content

how to insert different shipping cost in carrier module development


Tje123
 Share

Recommended Posts

in my controller, i have cost value for shipping.i'm trying to send it to `getOrderShippingCost` function. but my cart showing shipping `free`

**Controller.php**    

$cost_val=120; //this value can be change
    
    include_once(_PS_MODULE_DIR_.'delivery_scheduler/delivery_scheduler.php');
    
        $DeliveryWeekSched=new delivery_scheduler();
    
        $DeliveryWeekSched->getOrderShippingCost($cost_val,$cost_val);

 

**delivery_scheduler.php**

 

  public function getOrderShippingCost($params, $shipping_cost)
        {
            if (Context::getContext()->customer->logged == true)
            {
                $id_address_delivery = Context::getContext()->cart->id_address_delivery;
                $address = new Address($id_address_delivery);
                return 100; // i want to return `$shipping_cost`
            }
            return $shipping_cost;
        }

when return `$shipping_cost` shipping value in cart showing `free`.when `100` return cart shipping value showing `100`.why is that?how to return my value?

Edited by Tje123 (see edit history)

Share this post


Link to post
Share on other sites

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More