Testa Wetail Shipping riskfritt!
Modern frakttjänst. Designad för WooCommerce.
WooCommerce Fortnox actions och filters – komplett översikt
wf_eu_vat_meta_key
Description:
This filter allows you to modify the meta key used for storing the EU VAT number in order or customer metadata.
Variables:
$meta_key (string): The default meta key for storing the VAT number. This could be something like _eu_vat_number.
Usage Example:
add_filter('wf_eu_vat_meta_key', function($meta_key) {
return '_custom_vat_number';
});
_custom_vat_number.wf_eu_vat_number
Description:
Filters the EU VAT number before it is used or stored.
Variables:
Usage Example:
add_filter('wf_eu_vat_number', function($vat_number) {
return strtoupper($vat_number); // Convert VAT number to uppercase.
});
wf_eu_vat_number_is_valid
Description:
Filters the boolean result of a VAT number validation check.
Variables:
true if valid, false otherwise.Usage Example:
add_filter('wf_eu_vat_number_is_valid', function($is_valid, $vat_number) {
return custom_vat_validation($vat_number);
}, 10, 2);
wf_customer_url
Description:
Filters the URL endpoint used to communicate with the Fortnox API for customer data.
Variables:
Usage Example:
add_filter('wf_customer_url', function($url) {
return $url . '?additional_param=true';
});
wf_customer_before_post
Description:
Filters the customer data before it is sent to Fortnox.
Variables:
Usage Example:
add_filter('wf_customer_before_post', function($customer_data) {
$customer_data['name'] = sanitize_text_field($customer_data['name']);
return $customer_data;
});
wf_customer_vat_info
Description:
Filters the VAT information of a customer before it is sent to Fortnox.
Variables:
Usage Example:
add_filter('wf_customer_vat_info', function($vat_info) {
$vat_info['vat_status'] = 'active';
return $vat_info;
});
wf_refund_invoice_payload_before_create
Description:
Filters the payload data for a refund invoice before it is created in Fortnox.
Variables:
Usage Example:
add_filter('wf_refund_invoice_payload_before_create', function($payload) {
$payload['amount'] = $payload['amount'] * 0.9; // Apply a 10% discount.
return $payload;
});
wf_refund_invoice_payment_before_create_or_update
Description:
Filters the payment data associated with a refund invoice before creation or update in Fortnox.
Variables:
Usage Example:
add_filter('wf_refund_invoice_payment_before_create_or_update', function($payment_data) {
$payment_data['method'] = 'bank_transfer';
return $payment_data;
});
wf_invoice_refund_row_payload_before_create_or_update
Description:
Filters the data for each refund row in an invoice before it is created or updated in Fortnox.
Variables:
Usage Example:
add_filter('wf_invoice_refund_row_payload_before_create_or_update', function($row_data) {
// Adjust the refund quantity
$row_data['quantity'] = max(0, $row_data['quantity'] - 1);
// Decrease refund by 1 unit.
return $row_data;
});
wf_invoice_before_create_or_update
Description:
Filters the invoice data before it is created or updated in Fortnox.
Variables:
Usage Example:
add_filter('wf_invoice_before_create_or_update', function($invoice_data, $order) {
// Add a custom note to the invoice
$invoice_data['notes'][] = 'Processed by custom plugin.'; return $invoice_data;
}, 10, 2);
wf_invoice_payment_before_create_or_update
Description:
Filters the payment data associated with an invoice before creation or update in Fortnox.
Variables:
Usage Example:
add_filter('wf_invoice_payment_before_create_or_update', function($payment_data, $order) {
// Set a custom payment method for all invoices
$payment_data['method'] = 'credit_card';
return $payment_data;
}, 10, 2);
wf_order_number
Description:
Filters the order number used in the Fortnox integration.
Variables:
Usage Example:
add_filter('wf_order_number', function($order_number, $order) {
return '111' . $order_number; // Prefix order numbers with FNX for Fortnox.
}, 10, 2);
wf_order_payload_before_create_or_update
Description:
Filters the order data before it is sent to Fortnox for creation or updating.
Variables:
Usage Example:
add_filter('wf_order_payload_before_create_or_update', function($order_data, $order) {
// Add a custom field to the order payload
$order_data['custom_field'] = 'Custom Value'; return $order_data;
}, 10, 2);
wf_order_vat_included
Description:
Filters whether VAT is included in the order sent to Fortnox.
Variables:
true if VAT is included, false if not.Usage Example:
add_filter('wf_order_vat_included', function($vat_included, $order) {
return true;
// Ensure VAT is always included.
}, 10, 2);
wf_order_payload_before_send
Description:
Filters the final order payload just before it is sent to Fortnox.
Variables:
Usage Example:
add_filter('wf_order_payload_before_send', function($order_payload, $order) {
// Add a final modification to the order payload
$order_payload['final_check'] = true;
return $order_payload;
}, 10, 2);
wf_order_row_product
Description:
Filters the product data associated with an order row before it is included in the payload to Fortnox.
Variables:
name, SKU, and price.Usage Example:
add_filter('wf_order_row_product', function($product_data, $order_item) {
$product_data['name'] = strtoupper($product_data['name']);
return $product_data;
}, 10, 2);
wf_product_name
Description:
Filters the product name before it is used in an order row or elsewhere.
Variables:
Usage Example:
add_filter('wf_product_name', function($product_name, $product_id) {
return $product_name . ' (Special Edition)';
}, 10, 2);
wf_order_row_payload_before_create_or_update
Description:
Filters the data for each order row before it is created or updated in Fortnox.
Variables:
Usage Example:
add_filter('wf_order_row_payload_before_create_or_update', function($row_data, $order_item) {
// Adjust quantity or pricing logic before sync
$row_data['quantity'] = $row_data['quantity'] * 2;
// Double the quantity for some reason.
return $row_data;
}, 10, 2);
wf_order_row_sales_account
Description:
Filters the sales account used for an order row.
Variables:
Usage Example:
add_filter('wf_order_row_sales_account', function($sales_account, $row_data, $order_item) {
// Change sales account based on product category $product = wc_get_product($order_item->get_product_id());
if (in_array('special-category', $product->get_category_ids())) {
return 'SPECIAL_ACCOUNT';
}
return $sales_account;
}, 10, 3);
wf_order_shipping_account
Description:
Filters the shipping account used in an order.
Variables:
Usage Example:
add_filter('wf_order_shipping_account', function($shipping_account, $order) {
// Set a specific shipping account for international orders
return ($order->get_shipping_country() !== 'SE') ? 'INTL_SHIPPING' : $shipping_account;
}, 10, 2);
wf_custom_shipping
Description:
Filters custom shipping data before it is included in the order payload sent to Fortnox.
Variables:
Usage Example:
add_filter('wf_custom_shipping', function($shipping_data, $order) {
// Add custom shipping details
$shipping_data['custom_field'] = 'Custom Value';
return $shipping_data;
}, 10, 2);
wf_order_way_of_delivery
Description:
Filters the way of delivery for an order before it is synced with Fortnox.
Variables:
'home delivery', 'pickup').Usage Example:
add_filter('wf_order_way_of_delivery', function($way_of_delivery, $order) {
// Override the way of delivery based on order value
return ($order->get_total() > 1000) ? 'premium_delivery' : $way_of_delivery;
}, 10, 2);
wf_order_terms_of_delivery
Description:
Filters the terms of delivery for an order before syncing with Fortnox.
Variables:
'FOB', 'CIF').Usage Example:
add_filter('wf_order_terms_of_delivery', function($terms_of_delivery, $order) {
// Set terms of delivery based on shipping country
return ($order->get_shipping_country() === 'US') ? 'FOB' : $terms_of_delivery;
}, 10, 2);
Beställ Licens
Beställ din licens till Fortnox här
Support • Uppdateringar • Ingen bindningstid
Övriga tjänster
-
Utveckla er e-handel
Vi bygger allt från specialplugins till premium e-handelsplatser
-
Premium hosting
Med modern serverstruktur maxar du din e-handels hastighet
-
Komplexa integrationsflöden
Wetail iPaas aggregerar data och hanterar komplexa integrationer mellan flera olika system