Fortnox - Hooks (Actions)

Hooks in WordPress essentially allow you to change or add code without editing core files. They are used extensively throughout WordPress and WooCommerce and are very useful for developers.

Read more about action and filter hooks here:
In Fortnox there are some actions and filters available, mainly for modifying the data sent to Fortnox.

Before Product Sync

Action:    'obj_fortnox_before_sync_product'

Parameters: 
$product_id ID of the product being synced

Description: Fired when a product is going to be synced

This action can be used to create custom events before a product sync occurs.

After Product Sync

Action:    'obj_fortnox_after_sync_product'

Parameters: 
$product_id ID of the product that was synced
$new_article Entire response object from the request, This contains the Fortnox-article.

Description: Fired when a product was synced to Fortnox

This action can be used to create custom logic based on response data AFTER a product was synced.

Before Updated Product Sync

Action:    'obj_fortnox_before_sync_updated_product'

Parameters: 
$product_id ID of the product that was updated

Description: Fired when a product was updated. This happens before validation of settings are done.

This action can be used to create custom logic based on response data BEFORE a product was updated.

After Updated Product Sync

Action:    'obj_fortnox_after_sync_updated_product'

Parameters: 
$product_id ID of the product that was updated
$new_article Entire response object from the request, This contains the Fortnox-article.

Description: Fired when a product was updated.

This action can be used to create custom logic based on response data AFTER a product was synced.

Before Guest User Sync

Action:    'obj_fortnox_before_sync_guser'

Parameters: 
$order_id ID of the order that is connected to the guest-user.

Description: Fired before we create a new user in Fortnox

This action can be used to create custom logic based on what action that was triggered.

After Guest User Sync

Action:    'obj_fortnox_after_sync_guser'

Parameters: 
$order_id ID of the order that is connected to the guest-user.
$new_customer Entire response object from the request, This contains the Fortnox-Response.

Description: Fired after we create a new user in Fortnox

This action can be used to create custom logic based on what action that was triggered.

Before Update Guest User

Action:    'obj_fortnox_before_update_sync_guser'

Parameters: 
$order_id ID of the order that is connected to the guest-user.

Description: Fired before we update guest-user in Fortnox

This action can be used to create custom logic based on what action that was triggered.

After Update Guest User

Action:    'obj_fortnox_after_update_sync_guser'

Parameters: 
$order_id ID of the order that is connected to the guest-user.
$new_customer Entire response object from the request, This contains the Fortnox-Response.

Description: Fired after we update guest-user in Fortnox

This action can be used to create custom logic based on what action that was triggered.

Before User Sync

Action:    'obj_fortnox_before_sync_user'

Parameters: 
$user_id ID of the userthat is going to be synced.

Description: Fired before we create a new user in Fortnox

This action can be used to create custom logic based on what action that was triggered.

After User Sync

Action:    'obj_fortnox_after_sync_user'

Parameters: 
$user_id ID of the user that was just synced to Fortnox.
$new_customer Entire response object from the request, This contains the Fortnox-Response.

Description: Fired after we create a new user in Fortnox

This action can be used to create custom logic based on what action that was triggered.

Before Update User

Action:    'obj_fortnox_before_update_sync_user'

Parameters: 
$user_id ID of the user that maybe will be updated.

Description: Fired before we update user in Fortnox

This action can be used to create custom logic based on what action that was triggered.

After Update User

Action:    'obj_fortnox_after_update_sync_user'

Parameters: 
$user_id ID of the user that was updated.
$new_customer Entire response object from the request, This contains the Fortnox-Response.

Description: Fired after we update guest-user in Fortnox

This action can be used to create custom logic based on what action that was triggered.

Before Create Offer

Action:    'obj_fortnox_before_sync_offer'

Parameters: 
$order_id ID of the Order that should be turned into an offer in Fortnox

Description: Fired when a call to Fortnox is going to happen

This action can be used to create custom logic before an offer is created.

After Create Offer

Action:    'obj_fortnox_after_sync_offer'

Parameters: 
$order_id ID of the Order that should be turned into an offer in Fortnox
$new_offer Object containing the response from Fortnox

Description: Fired when a call to Fortnox has happened

This action can be used to create custom logic after an offer is created.

Before Create Order from Offer

Action:    'obj_fortnox_before_create_offer_order'

Parameters: 
$order_id ID of the Order that should be turned into an order in Fortnox

Description: Fired when a call to Fortnox has happened

This action can be used to create custom logic before an order is created from an offer.

After Create Order from Offer

Action:    'obj_fortnox_after_create_offer_order'

Parameters: 
$order_id ID of the Order that have been turned into an order in Fortnox

Description: Fired when a call to Fortnox has happened

This action can be used to create custom logic after an order is created from an offer.

Before Order is synced

Action:    'obj_fortnox_before_sync_order'

Parameters: 
$order_id ID of the Order that are going to be synced

Description: Fired when a call to Fortnox is going to happen

This action can be used to create custom logic before an order is synced

After Order is synced

Action:    'obj_fortnox_after_sync_order'

Parameters: 
$order_id ID of the Order that are going to be synced
$new_order Object containing the response from Fortnox

Description: Fired when a call to Fortnox has happend

This action can be used to create custom logic after an order is synced

Before we cancel an Order

Action:    'obj_fortnox_before_sync_canceled_order'

Parameters: 
$order_id ID of the Order that are going to be canceled

Description: Fired when a call to Fortnox is going to happen

This action can be used to create custom logic before an order is canceled

After Order was Canceled

Action:    'obj_fortnox_after_sync_canceled_order'

Parameters: 
$order_id ID of the Order that was canceled

Description: Fired when a call to Fortnox is going to happen

This action can be used to create custom logic after an order is canceled
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.