My situation is similar to this. I have used the same steps to update the rate of the shipping cost variable and it is not doing so. I am using CS cart 4.13.x
I have to abide by some wholesaler conditions. I have edited the shipping costs as per my need using the cart function and added respective costs while doing so. My issue is that after I add those shipping costs to the front end, I now need to add that to the order total as well.
If I can update the shipping cost rates, I should be able to get the expected results. But, I am not able to do so.
//Updating the shipping cost and recalculating it
if (!empty($cart['shipping'])){
foreach ($cart['shipping'] as $shipping_key => $shipping)
{
$cart['shipping'][$shipping_key]['rate'] = $freight;
foreach ($shipping['rate_info']['rate_value']['C'] as $rate_key => $rate)
{
$cart['shipping'][$shipping_key]['rate_info']['rate_value']['C'][$rate_key]['value'] = $freight;
}
}
// Recalculate cart content
}
fn_calculate_cart_content($cart, Tygh::$app['session']['auth'], 'E', true,'F',true);
Registry::get('view')->assign('cart',$cart);
The cart values are getting updated but for some reason during calculation, it doesn’t work. I know I am missing something here and I need some assistance.