azazqadir azazqadir - 8 months ago
1158 0

Using WooCommerce Rest API to create a Custom Dashboard

PHP

woocommmercerestapi.php

<div class="container">

                                  <h2 class="sub-header">Customers List</h2>

                                  <div class='table-responsive'>

                                      <table id='myTable' class='table table-striped table-bordered'>

                                          <thead>

                                              <tr>

                                                  <th>Email</th>

                                                  <th>Name</th>

                                                  <th>Billing Address</th>

                                                  <th>Total Orders</th>

                                                  <th>Total spent</th>

                                                  <th>Avatar</th>

                                                  <th>Actions</th>

                                              </tr>

                                          </thead>

                                          <tbody>

                                              <?php

                  foreach($customers as $customer){



                  echo "<tr><td>" . $customer["email"]."</td>

                            <td>" . $customer["first_name"].$customer["last_name"]."</td>

                            <td>" . $customer["billing"]["address_1"]."</td>

                            <td>" . $customer["orders_count"]."</td>

                            <td>" . $customer["total_spent"]."</td>

                            <td><img height='50px' width='50px' src='".$customer["avatar_url"]."'></td>

                             <td><a class='open-AddBookDialog btn btn-primary' data-target='#myModal' data-id=".$customer['id']." data-toggle='modal'>Update</a>

                             <a class='open-deleteDialog btn btn-danger' data-target='#myModal1' data-id=".$customer['id']." data-toggle='modal'>Delete</a></td></tr>";

                  }



                  ?>

                                          </tbody>

                                      </table>

                                  </div>

  </div>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download