| @@ -19,8 +19,10 @@ | ||
| 19 | 19 | * @link https://webappick.com |
| 20 | 20 | * @property false|mixed|string $filter |
| 21 | 21 | * @property string $discount_valid_from |
| 22 | 22 | * @property string $discount_valid_to |
| 23 | + * @property int|string $id | |
| 24 | + * @property int|string $discount_max_user | |
| 23 | 25 | * @license https://opensource.org/licenses/gpl-license.php GNU Public License |
| 24 | 26 | * @category Utility |
| 25 | 27 | */ |
| 26 | 28 | class Config { |
| @@ -105,8 +107,10 @@ | ||
| 105 | 107 | 'discount_based_on' => '', |
| 106 | 108 | 'discount_label' => '', |
| 107 | 109 | 'discount_max_user' => '', |
| 108 | 110 | 'bogo_type' => '', |
| 111 | + 'count_quantity_as' => 'separate', | |
| 112 | + 'free_item_selection' => 'cart_order', | |
| 109 | 113 | 'discount_valid_from' => '', |
| 110 | 114 | 'discount_valid_to' => '', |
| 111 | 115 | 'discount_method' => 'automated', |
| 112 | 116 | 'discount_coupon' => '', |
| @@ -174,8 +178,36 @@ | ||
| 174 | 178 | * @return string |
| 175 | 179 | */ |
| 176 | 180 | public function get_bogo_type() { |
| 177 | 181 | return $this->config['bogo_type']; |
| 182 | + } | |
| 183 | + | |
| 184 | + /** | |
| 185 | + * Get Count Quantity As. | |
| 186 | + * How item quantities aggregate toward the tier min/max. | |
| 187 | + * | |
| 188 | + * @return string One of: separate, variations, filters. | |
| 189 | + */ | |
| 190 | + public function get_count_quantity_as(): string { | |
| 191 | + if ( empty( $this->config['count_quantity_as'] ) ) { | |
| 192 | + return 'separate'; | |
| 193 | + } | |
| 194 | + | |
| 195 | + return $this->config['count_quantity_as']; | |
| 196 | + } | |
| 197 | + | |
| 198 | + /** | |
| 199 | + * Get Free Item Selection (BOGO). | |
| 200 | + * Which qualifying item receives the free / discounted reward. | |
| 201 | + * | |
| 202 | + * @return string One of: cart_order, lowest, highest. | |
| 203 | + */ | |
| 204 | + public function get_free_item_selection(): string { | |
| 205 | + if ( empty( $this->config['free_item_selection'] ) ) { | |
| 206 | + return 'cart_order'; | |
| 207 | + } | |
| 208 | + | |
| 209 | + return $this->config['free_item_selection']; | |
| 178 | 210 | } |
| 179 | 211 | |
| 180 | 212 | /** |
| 181 | 213 | * Get Discount Rules |