Skip to content

Commit be841e6

Browse files
Added PHP examples
1 parent 0a9eb0c commit be841e6

File tree

5 files changed

+487
-2
lines changed

5 files changed

+487
-2
lines changed

source/includes/v2/_customers.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,45 @@ data = {
178178
print(wcapi.post("customers", data).text)
179179
```
180180

181+
```php
182+
<?php
183+
$data = array(
184+
'customer' => array(
185+
'email' => '[email protected]',
186+
'first_name' => 'John',
187+
'last_name' => 'Doe',
188+
'username' => 'john.doe',
189+
'billing_address' => array(
190+
'first_name' => 'John',
191+
'last_name' => 'Doe',
192+
'company' => '',
193+
'address_1' => '969 Market',
194+
'address_2' => '',
195+
'city' => 'San Francisco',
196+
'state' => 'CA',
197+
'postcode' => '94103',
198+
'country' => 'US',
199+
'email' => '[email protected]',
200+
'phone' => '(555) 555-5555'
201+
),
202+
'shipping_address' => array(
203+
'first_name' => 'John',
204+
'last_name' => 'Doe',
205+
'company' => '',
206+
'address_1' => '969 Market',
207+
'address_2' => '',
208+
'city' => 'San Francisco',
209+
'state' => 'CA',
210+
'postcode' => '94103',
211+
'country' => 'US'
212+
)
213+
)
214+
);
215+
216+
print_r($woocommerce->customers->create($data));
217+
?>
218+
```
219+
181220
> Response:
182221
183222
```json
@@ -257,6 +296,10 @@ WooCommerce.get('customers/2', function(err, data, res) {
257296
print(wcapi.get("customers/2").text)
258297
```
259298

299+
```php
300+
<?php print_r($woocommerce->customers->get(2)); ?>
301+
```
302+
260303
> Response:
261304
262305
```json
@@ -329,6 +372,10 @@ WooCommerce.get('customers', function(err, data, res) {
329372
print(wcapi.get("customers").text)
330373
```
331374

375+
```php
376+
<?php print_r($woocommerce->customers->get()); ?>
377+
```
378+
332379
> Response:
333380
334381
```json
@@ -482,6 +529,24 @@ data = {
482529
print(wcapi.put("customers/2", data).text)
483530
```
484531

532+
```php
533+
<?php
534+
$data = array(
535+
'customer' => array(
536+
'first_name' => 'James',
537+
'billing_address' => array(
538+
'first_name' => 'James'
539+
),
540+
'shipping_address' => array(
541+
'first_name' => 'James'
542+
)
543+
)
544+
);
545+
546+
print_r($woocommerce->customers->update(2, $data));
547+
?>
548+
```
549+
485550
> Response:
486551
487552
```json
@@ -554,6 +619,10 @@ WooCommerce.delete('customers/2', function(err, data, res) {
554619
print(wcapi.delete("customers/2").text)
555620
```
556621

622+
```php
623+
<?php print_r($woocommerce->customers->delete(2)); ?>
624+
```
625+
557626
> Response:
558627
559628
```json
@@ -590,6 +659,10 @@ WooCommerce.get('customers/2/orders', function(err, data, res) {
590659
print(wcapi.get("customers/2/orders").text)
591660
```
592661

662+
```php
663+
<?php print_r($woocommerce->customers->get_orders(2)); ?>
664+
```
665+
593666
> Response:
594667
595668
```json
@@ -747,6 +820,10 @@ WooCommerce.get('customers/2/downloads', function(err, data, res) {
747820
print(wcapi.get("customers/2/downloads").text)
748821
```
749822

823+
```php
824+
<?php print_r($woocommerce->customers->get_downloads(2)); ?>
825+
```
826+
750827
> Response:
751828
752829
```json
@@ -812,6 +889,10 @@ WooCommerce.get('customers/count', function(err, data, res) {
812889
print(wcapi.get("customers/count").text)
813890
```
814891

892+
```php
893+
<?php print_r($woocommerce->customers->get_count()); ?>
894+
```
895+
815896
> Response:
816897
817898
```json

0 commit comments

Comments
 (0)