Hook | actionFilterDeliveryOptionList |
---|---|
Locations | FO |
Type | action |
Origin | core |
Aliases |
Origin | File |
---|---|
core | classes/Cart.php |
<?php
[
'delivery_option_list' => (array) &$delivery_option_list,
]
Hook::exec(
'actionFilterDeliveryOptionList',
[
'delivery_option_list' => &$delivery_option_list,
]
)
For example :
In this example, we disable the express delivery carrier on saturdays and sundays because our delivery promise of 24 hours cannot be satisfied:
<?php
class MyCarrierConditionDisablerModule extends Module
{
public function install()
{
return parent::install() && $this->registerHook('actionFilterDeliveryOptionList');
}
public function hookActionCustomFilterDeliveryOptionList($params)
{
$deliveryOptionList = $params['delivery_option_list'];
if(0 == date('w') || 6 == date('w')){ // sundays or saturdays
// find carrier in $deliveryOptionList, and remove it
}
}
}