Created
February 21, 2019 14:17
-
-
Save renjith-ph/fb425beb488a5c057b6f5fe947d0df99 to your computer and use it in GitHub Desktop.
Snippet to replace the base cost of booking cost rule while calculating booking cost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Snippet to replace the base cost of booking cost rule while calculating booking cost | |
Created at : 21 Feb 2019 PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
*/ | |
add_filter('ph_booking_rule_for_setting_base_cost_and_unit_cost','ph_booking_update_rule_for_setting_base_cost_and_unit_cost',10,3); | |
function ph_booking_update_rule_for_setting_base_cost_and_unit_cost($rule,$from_date,$to_date) | |
{ | |
$updation_condition=array('from'=>'Friday','to'=>'Monday','base_cost'=>'79','unit_cost'=>''); // add base cost and unit cost, and this will replace the base cost of 4days rule while calculating booking cost | |
$from_date=date('l',$from_date); | |
$to_date=date('l',$to_date); | |
if($updation_condition['from']==$from_date && $updation_condition['to']==$to_date) | |
{ | |
$rule['base_cost']=$updation_condition['base_cost']; | |
$rule['cost_per_unit']=$updation_condition['unit_cost']; | |
} | |
return $rule; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment