title: List all enabled payment methods in Woocommerce
body: <p>I'm working on mimicking the Orders Page in the Admin side to the UI of the site. It's like a complete rip off of what's on the backend.</p>
  
  <p>I'm stucked with listing all the enabled Payment Methods. Does anyone know how can I achieve it?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;?php
  global $woocommerce;
  wp_enqueue_script('jquery');
  wp_enqueue_script('jquery-ui-core');
  wp_enqueue_script('jquery-ui-datepicker');
  wp_enqueue_style('jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
  
  if(isset( $_GET['status_id'] )){
      $update_order_id = $_GET['status_id'];
  }
  $data = array(
          'order_id' =&gt; $update_order_id
      );
  // $result = wc_get_order_id_by_order_key();
  $result = new WC_Order($update_order_id);
  $order_date = explode(' ',$result-&gt;order_date);
  $order_time = explode(':', $order_date[1]);
  $order_time_hour = $order_time[0];
  $order_time_minute = $order_time[1];
  $order_date = $order_date[0];
  $order_time_minute = $order_time[1];
  $status = $result-&gt;post_status;
  // print_r($result-&gt;get_payment_method());
  $customer = new WC_Customer($update_order_id);
  $payment_method_title = $result-&gt;payment_method_title;
  $customer_email = $result-&gt;billing_email;
  $customer_number = $result-&gt;customer_user;
  $customer_first_name = $result-&gt;shipping_first_name;
  $customer_details = get_post_meta($update_order_id);
  // $customer_payment_title = $result-&gt;payment_method_title;
  $customer_payment_title = get_post_meta($update_order_id,'_payment_method_title',true);
  //print_r($customer_details);
  $shipping_flight_number = $customer_details['shipping_flight_number'][0];
  $shipping_flight_date = $customer_details['shipping_flight_date'][0];
  $billing_first_name = $customer_details['_billing_first_name'][0];
  $billing_last_name = $customer_details['_billing_last_name'][0];
  $billing_company = $customer_details['_billing_company'][0];
  $billing_address_1 = $customer_details['_billing_address_1'][0];
  $billing_address_2 = $customer_details['_billing_address_2'][0];
  $billing_city = $customer_details['_billing_city'][0];
  $billing_postcode = $customer_details['_billing_postcode'][0];
  $billing_country = $customer_details['_billing_country'][0];
  $billing_email = $customer_details['_billing_email'][0];
  $billing_phone = $customer_details['_billing_phone'][0];
  $ip_address = $result-&gt;customer_ip_address;
  $countries_obj   = new WC_Countries();
  $countries   = $countries_obj-&gt;__get('countries');
  $default_country = $countries_obj-&gt;get_base_country();
  $default_county_states = $countries_obj-&gt;get_states( $default_country );
  $customer_county = $result-&gt;billing_state;
  $payment_gateways_obj = new WC_Payment_Gateways();
  $enabled_payment_gateways = $payment_gateways_obj-&gt;payment_gateways();
  // print_r($enabled_payment_gateways);
  ?&gt;
  &lt;div class="entry-content"&gt;
  &lt;h3&gt;Order #&lt;?php echo $update_order_id; ?&gt; details&lt;/h3&gt;
  &lt;h4&gt;Payment via &lt;?php echo $payment_method_title; ?&gt;. Customer IP: &lt;?php echo $ip_address; ?&gt;&lt;/h4&gt;
  &lt;div class="row"&gt;
      &lt;div class="details-holder"&gt;
          &lt;div class="col-md-4 details"&gt;
              &lt;label&gt;General Details&lt;/label&gt;
              &lt;form class="form-horizontal"&gt;
                  &lt;div class="form-group"&gt;
                  &lt;label for="OrderDate" class="col-sm-12 control-label to-the-left"&gt;Order Date:&lt;/label&gt;
                      &lt;div class="col-sm-12"&gt;
                          &lt;input type="text" class="col-sm-4" id="date" name="date" value="&lt;?php echo ($order_date != '') ? $order_date: ''; ?&gt;"/&gt;@
                          &lt;input type="number" class="hour" placeholder="h" name="order_date_hour" id="order_date_hour" min="0" max="23" step="1" value="&lt;?php echo ($order_time_hour != '')? $order_time_hour: ''; ?&gt;" pattern="([01]?[0-9]{1}|2[0-3]{1})"&gt;
                          :
                          &lt;input type="number" class="minute" placeholder="m" name="order_date_minute" id="order_date_minute" min="0" max="59" step="1" value="&lt;?php echo ($order_time_minute != '') ? $order_time_minute:''; ?&gt;" pattern="[0-5]{1}[0-9]{1}"&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="OrderStatus" class="col-sm-12 control-label to-the-left"&gt;Order Status:&lt;/label&gt;
                      &lt;?php $statuses = wc_get_order_statuses(); ?&gt;
                      &lt;div class="col-sm-12"&gt;
                      &lt;select name="orderstatus" class="form-control custom-select col-sm-4"&gt;
                          &lt;?php foreach( $statuses as $skey =&gt; $status ) : ?&gt;
                              &lt;option &lt;?php echo ( ( isset( $status ) &amp;&amp; $status == $skey ) ? 'selected="selected"' : '' )?&gt; value="&lt;?php echo $skey;?&gt;"&gt;&lt;?php echo $status; ?&gt;&lt;/option&gt;
                          &lt;?php endforeach; ?&gt;
                      &lt;/select&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="CustomerInfo" class="col-sm-12 control-label to-the-left"&gt;Customer:&lt;/label&gt;
                      &lt;div class="col-sm-12"&gt;
                          &lt;?php
                              if($customer_number == 0){
                                  echo "Guest";
                              } else {
                          ?&gt;
                          &lt;?php echo ($customer_first_name != '') ? $customer_first_name: ''; ?&gt; (#&lt;?php echo ($customer_number !='') ? $customer_number:''; ?&gt; - &lt;?php echo ($customer_email != '') ? $customer_email:'' ; ?&gt;)
                          &lt;?php 
                              }
                          ?&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label&gt;Additional Details&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label&gt;Travel Details&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;label for="FlightNumber" class="col-sm-12 control-label to-the-left"&gt;Fligh Number: &lt;?php echo $shipping_flight_number; ?&gt;&lt;/label&gt;
                  &lt;label for="FlightDate" class="col-sm-12 control-label to-the-left"&gt;Fligh Date: &lt;?php echo $shipping_flight_date; ?&gt;&lt;/label&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="details-holder"&gt;
          &lt;div class="col-md-4 details"&gt;
              &lt;label&gt;Billing Details&lt;/label&gt;
              &lt;form class="form-horizontal"&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="BillingFirstName" class="col-sm-6 control-label to-the-left"&gt;First Name:&lt;/label&gt;
                      &lt;label for="BillingLastName" class="col-sm-6 control-label to-the-left"&gt;Last Name:&lt;/label&gt;
                      &lt;div class="col-sm-6"&gt;
                          &lt;input type="text" class="col-sm-12" name="billing_first_name" value="&lt;?php echo ($billing_first_name != '') ? $billing_first_name: ''; ?&gt;" /&gt;
                      &lt;/div&gt;
                      &lt;div class="col-sm-6"&gt;
                          &lt;input type="text" class="col-sm-12" name="billing_last_name" value="&lt;?php echo ($billing_last_name != '') ? $billing_last_name: ''; ?&gt;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="BillingCompany" class="col-sm-12 control-label to-the-left"&gt;Company:&lt;/label&gt;
                      &lt;div class="col-sm-12"&gt;
                          &lt;input type="text" class="col-sm-12" name="billing_company" value="&lt;?php echo ($billing_company != '') ? $billing_company: ''; ?&gt;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="BillingAddress1" class="col-sm-6 control-label to-the-left"&gt;Address 1:&lt;/label&gt;
                      &lt;label for="BillingAddress2" class="col-sm-6 control-label to-the-left"&gt;Address 2:&lt;/label&gt;
                      &lt;div class="col-sm-6"&gt;
                          &lt;input type="text" class="col-sm-12" name="billing_address_1" value="&lt;?php echo ($billing_address_1 != '') ? $billing_address_1: ''; ?&gt;" /&gt;
                      &lt;/div&gt;
                      &lt;div class="col-sm-6"&gt;
                          &lt;input type="text" class="col-sm-12" name="billing_address_2" value="&lt;?php echo ($billing_address_2 != '') ? $billing_address_2: ''; ?&gt;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="BillingCity" class="col-sm-6 control-label to-the-left"&gt;City:&lt;/label&gt;
                      &lt;label for="BillingPostcode" class="col-sm-6 control-label to-the-left"&gt;Postcode:&lt;/label&gt;
                      &lt;div class="col-sm-6"&gt;
                          &lt;input type="text" class="col-sm-12" name="billing_city" value="&lt;?php echo ($billing_city != '') ? $billing_city: ''; ?&gt;" /&gt;
                      &lt;/div&gt;
                      &lt;div class="col-sm-6"&gt;
                          &lt;input type="text" class="col-sm-12" name="billing_postcode" value="&lt;?php echo ($billing_postcode != '') ? $billing_postcode: ''; ?&gt;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="BillingCountry" class="col-sm-6 control-label to-the-left"&gt;Country:&lt;/label&gt;
                      &lt;label for="BillingState" class="col-sm-6 control-label to-the-left"&gt;State/County:&lt;/label&gt;
                      &lt;div class="col-sm-6"&gt;
                          &lt;select class="form-control col-sm-12"&gt;
                              &lt;?php foreach( $countries as $skey =&gt; $country ) : ?&gt;
                                  &lt;option &lt;?php echo ( ( $billing_country == $skey ) ? 'selected="selected"' : '' )?&gt; value="&lt;?php echo $skey;?&gt;"&gt;&lt;?php echo $country; ?&gt;&lt;/option&gt;
                              &lt;?php endforeach; ?&gt;
                          &lt;/select&gt;
                      &lt;/div&gt;
                      &lt;div class="col-sm-6"&gt;
                          &lt;select class="form-control col-sm-12"&gt;
                              &lt;?php foreach( $default_county_states as $skey =&gt; $county ) : ?&gt;
                                  &lt;option &lt;?php echo ( ( $customer_county == $skey ) ? 'selected="selected"' : '' )?&gt; value="&lt;?php echo $skey;?&gt;"&gt;&lt;?php echo $county; ?&gt;&lt;/option&gt;
                              &lt;?php endforeach; ?&gt;
                          &lt;/select&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="BillingEmail" class="col-sm-6 control-label to-the-left"&gt;Email:&lt;/label&gt;
                      &lt;label for="BillingPhone" class="col-sm-6 control-label to-the-left"&gt;Phone:&lt;/label&gt;
                      &lt;div class="col-sm-6"&gt;
                          &lt;input type="text" class="col-sm-12" name="billing_email" value="&lt;?php echo ($billing_email != '') ? $billing_email: ''; ?&gt;" /&gt;
                      &lt;/div&gt;
                      &lt;div class="col-sm-6"&gt;
                          &lt;input type="text" class="col-sm-12" name="billing_phone" value="&lt;?php echo ($billing_phone != '') ? $billing_phone: ''; ?&gt;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="BillingPaymentTitle" class="col-sm-6 control-label to-the-left"&gt;Payment Method:&lt;/label&gt;
                      &lt;div class="col-md-12"&gt;
                          &lt;input class="col-sm-12" type="text" name="billing_payment_title" value="&lt;?php echo ($customer_payment_title != '') ? $customer_payment_title : ''; ?&gt;"&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="details-holder"&gt;
          &lt;div class="col-md-4 details"&gt;
              &lt;label&gt;Shipping Details&lt;/label&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>The one I have is:</p>
  
  <blockquote>
    <p>$payment_gateways_obj = new WC_Payment_Gateways();
    $enabled_payment_gateways = $payment_gateways_obj->payment_gateways();</p>
  </blockquote>
  
  <p>Wherein, if I <code>print_r($enabled_payment_gateways)</code>, it shows all the payment gateways data. But I just need the payment gateways which are enabled.</p>
  
  <p>I hope someone can help.</p>
  
  <p>Thanks!
  Eli
  <a href="https://i.stack.imgur.com/svJqa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/svJqa.png" alt="enter image description here"></a></p>