Created
October 20, 2020 07:29
-
-
Save Balakrishnan-flycart/ae8433829f248ff5d75dfc0c794dcc6a to your computer and use it in GitHub Desktop.
Woo Discount Rules v2 - Get rules start date and end date
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
| if ( class_exists('\Wdr\App\Controllers\ManageDiscount')) { | |
| $rules = \Wdr\App\Controllers\ManageDiscount::$available_rules; | |
| $start_date = $end_date = array(); | |
| if(!empty($rules) && is_array($rules)){ | |
| foreach ($rules as $rule){ | |
| if($rule->rule->enabled == 1){ | |
| $rule_id = $rule->rule->id; | |
| //get timestamp | |
| $start_date_timestamp = $rule->rule->date_from; | |
| $end_date_timestamp = $rule->rule->date_to; | |
| //Date format | |
| $format = "Y-m-d H:i:s"; | |
| $start_date[$rule_id] = date($format, $start_date_timestamp); | |
| $end_date[$rule_id] = date($format, $end_date_timestamp); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment