Created
January 7, 2019 13:29
-
-
Save renjith-ph/7ed901ce02a6eb8b600a83e596e8d99b to your computer and use it in GitHub Desktop.
Snippet to get additional number of people from total persons.
This file contains hidden or 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 get additional number of people from total persons. | |
| * Created at : 7 Jan 2019 | |
| * PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
| */ | |
| add_filter( 'phive_booking_total_person_details', 'phive_booking_get_additional_person_details', 10,2 ); | |
| function phive_booking_get_additional_person_details($total_person_detail,$product_id) | |
| { | |
| $minimum_person_details = array( | |
| '323' => array( // Product Id | |
| array( | |
| 'minimum_person' => 2 // minimum participant for type 1 | |
| ), | |
| array( | |
| 'minimum_person' => 3 | |
| ), | |
| ), | |
| '1190' => array( // Product Id | |
| array( | |
| 'minimum_person' => 1 | |
| ), | |
| array( | |
| 'minimum_person' => 2 | |
| ), | |
| ), | |
| ); | |
| if( empty($minimum_person_details[$product_id]) ) | |
| return $total_person_detail; | |
| foreach( $total_person_detail as $key => &$number_of_persons ) { | |
| if( ! empty($minimum_person_details[$product_id][$key]) ) { | |
| $number_of_persons-=$minimum_person_details[$product_id][$key]['minimum_person']; | |
| } | |
| } | |
| return $total_person_detail; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment