Warning: You are browsing the documentation for PrestaShop 8, which is outdated.
You might want to read an updated version of this page for the current version, PrestaShop 9. Read the updated version of this page
Hook | actionFilterDeliveryOptionList |
---|---|
Locations | FO |
Type | action |
Origin | core |
Aliases | |
Description | This hook allows you to modify delivery option list |
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 hookActionFilterDeliveryOptionList($params)
{
$deliveryOptionList = $params['delivery_option_list'];
if(0 == date('w') || 6 == date('w')){ // sundays or saturdays
// find carrier in $deliveryOptionList, and remove it
}
}
}