From eaf3f4f32e893231b7e70eadd656117492b94a19 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Wed, 23 Oct 2024 09:08:10 +0200 Subject: [PATCH] Document actions --- documentation/Plugin-API-Functions.md | 64 +++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 documentation/Plugin-API-Functions.md diff --git a/documentation/Plugin-API-Functions.md b/documentation/Plugin-API-Functions.md new file mode 100644 index 00000000..e50220c3 --- /dev/null +++ b/documentation/Plugin-API-Functions.md @@ -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); +}); +``` + + + +