Skip to content

Commit

Permalink
Document actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Oct 23, 2024
1 parent 6869420 commit eaf3f4f
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions documentation/Plugin-API-Functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
### Programmatically capture, refund, void, cancel, and ship Mollie orders.

With the Mollie API, you can programmatically capture, refund, void, cancel, and ship orders.
These actions are logged by the plugin.
Here are some examples of how to use these functions:

#### Capture an order
```php
use function Mollie\WooCommerce\Inc\Api\mollie_capture_order;

add_action('init', function () {
$order_id = 123;
$order = wc_get_order($order_id);
mollie_capture_order($order);
});
```

#### Refund an order
```php
use function Mollie\WooCommerce\Inc\Api\mollie_refund_order;

add_action('init', function () {
$order_id = 123;
$order = wc_get_order($order_id);
mollie_refund_order($order);
});
```

#### Void an order
```php
use function Mollie\WooCommerce\Inc\Api\mollie_void_order;

add_action('init', function () {
$order_id = 123;
$order = wc_get_order($order_id);
mollie_void_order($order);
});
```

#### Cancel an order
```php
use function Mollie\WooCommerce\Inc\Api\mollie_cancel_order;

add_action('init', function () {
$order_id = 123;
$order = wc_get_order($order_id);
mollie_cancel_order($order);
});
```

#### Ship an order
```php
use function Mollie\WooCommerce\Inc\Api\mollie_ship_order;

add_action('init', function () {
$order_id = 123;
$order = wc_get_order($order_id);
mollie_ship_order($order);
});
```




0 comments on commit eaf3f4f

Please sign in to comment.