DataJet
Search…
Introduction
Coming soon
Hooks are pieces of code that let you modify (or extend) task functionalities. Custom logic can be implemented with Liquid language.
Each task might have up to 5 slots for hooks. Currently, there are 5 different types of hooks, named after the moment they are executed.
    Before Task - triggers just before any tasks starts.
    Before Action - triggers before an action of the task (this could be fulfillment creation, customer creation, inventory adjustment etc.)
    After Action - triggers after action is performed
    After Task - triggers after task completes
    General - special type, this hook appears only in Blank Tasks.
Each hook might have different objects preloaded. You can interact with those objects and add additional actions to task execution process.
Hooks can be set up during task creation process. After you select your task your will be taken through few steps where you will add all information required to run the task. One of the steps is called Hooks. Here you will be able to add one of the predefined Hooks or create your own. On the right panel you can also lookup all objects that are available to use at this stage.
Hook step

Example

Let's assume you are setting up Export orders to FTP task. This task anytime new order is placed it exports selected order properties to an FTP.
You would like to export only paid orders. To do so you would configure Before Action hook that checks whats order financial status and if its different than paid, it would just skip exporting order. This logic implemented with Liquid would look like this:
1
{% unless order %} {% assign order = "{}" | parse %} {% endunless %}
2
3
{% if order.financial_status != "paid" %}
4
{% skip %}
5
{% endif %}
Copied!
Last modified 9mo ago
Copy link