PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.4.14
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.4.14
1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 1.3.47 1.3.46 1.3.45 All 177 releases
disco / app / DropDown / StoreDropDown.php

StoreDropDown.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO 1.4.14, at app/DropDown/StoreDropDown.php

90 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Disco\App\DropDown;
4
5 use WC_Countries;
6 use WC_Payment_Gateways;
7
8 /**
9 * Class DropDown
10 *
11 * @package Disco
12 * @subpackage app\DropDown
13 * @author Ohidul Islam <wahid0003@gmail.com>
14 * @link https://webappick.com
15 * @license https://opensource.org/licenses/gpl-license.php GNU Public License
16 * @category Disco
17 */
18 class StoreDropDown {
19
20 /**
21 * Order Statuses List
22 *
23 * @return array
24 */
25 public static function order_status() {
26 return wc_get_order_statuses();
27 }
28
29 /**
30 * Payment Methods List
31 *
32 * @return array
33 */
34 public static function payment_methods() {
35 $wc_gateways = new WC_Payment_Gateways;
36 $payment_gateways = $wc_gateways->get_available_payment_gateways();
37 $payment_methods = array();
38
39 // Loop through Woocommerce available payment gateways
40 if ( !empty( $payment_gateways ) ) {
41 foreach ( $payment_gateways as $gateway_id => $gateway ) {
42 $payment_methods[$gateway_id] = $gateway->get_title();
43 }
44 }
45
46 return $payment_methods;
47 }
48
49 /**
50 * User Roles List
51 *
52 * @return array
53 */
54 public static function user_roles() {
55 global $wp_roles;
56
57 return $wp_roles->get_names();
58 }
59
60 /**
61 * Countries List
62 *
63 * @param bool $with_states Whether to include states or not.
64 * @return array
65 */
66 public static function countries( $with_states = false ) {
67 global $woocommerce;
68
69 $counties = ( new WC_Countries )->get_countries();
70
71 if ( $with_states ) {
72 foreach ( $counties as $key => $country ) {
73 $counties[$key] = $country;
74 $states = ( new WC_Countries )->get_states( $key );
75
76 if ( empty( $states ) ) {
77 continue;
78 }
79
80 foreach ( $states as $state_key => $state ) {
81 $counties[$key . ':' . $state_key] = $country . ' : ' . $state;
82 }
83 }
84 }
85
86 return $counties;
87 }
88
89 }
90