Table of Contents
Moneybird for Easy Digital Downloads is extensible in plenty of ways using filters and/or actions. Here you’ll find the available filters/action hooks, along with examples:
edd_moneybird_client_create_payment
Modify the payment, e.g. payment date, price or transaction ID, before it’s sent to the API.
Example: modify the payment’s Transaction ID
Note that you can also use the edd_moneybird_payment_transaction_id
filter for this. This is just an example to illustrate the possibilities.
function daan_modify_payment_transaction_id($payment, $invoice_id) { $payment['payment']['transaction_identifier'] = 'your-custom-transaction-id'; return $payment; } add_filter('edd_moneybird_client_create_payment', 'daan_modify_payment_transaction_id', 10, 2);
edd_moneybird_client_sales_invoice_contents
This filter allows for the modification of the sales invoice contents.
Example: modify the sales invoice’s reference
function daan_modify_sales_invoice_reference($invoice, $payment, $order_id, $contact_id) { $invoice['reference'] = 'your-custom-reference'; return $invoice; } add_filter('edd_moneybird_client_sales_invoice_contents', 'daan_modify_sales_invoice_reference', 10, 4);
Example: add a Custom Field Attribute
function daan_add_custom_fields_attributes($invoice, $payment, $order_id, $contact_id) { $invoice['custom_fields_attributes'] = [ [ 'id' => 'your-id', 'value' => 'your-value'; ] ]; return $invoice; } add_filter('edd_moneybird_client_sales_invoice_contents', 'daan_add_custom_fields_attributes', 10, 4);
edd_moneybird_contact_information
This filter allows you to modify the contact’s information, before saving it as a Moneybird contact. This filter is triggered when a contact is either updated or newly created.
Example: add company name from a custom checkout field
function daan_add_company_name( $contact, $payment, $customer ) { $contact[ 'type' ] = 'company'; $contact[ 'contact' ][ 'company_name' ] = 'Your Custom Company Name'; $contact[ 'contact' ][ 'tax_number' ] = $vat_details->vat_number ?? ''; return $contact; } add_filter('edd_moneybird_contact_information', 'daan_add_company_name', 10, 3);
edd_moneybird_do_not_sync_order
This filter allows you to set additional constraints to when an order is synced as an invoice to Moneybird.
edd_moneybird_do_not_sync_payment
This filter allows to to set additional constraints to when a payment is synced to Moneybird.
edd_moneybird_invoice_details
Modify the invoice details, e.g. order rows, before the invoice is created.
edd_moneybird_payment_transaction_id
This filter is useful if e.g. your payment provider plugin doesn’t provide a Transaction ID to the EDD_Payment object upon creation.