Mechanic Get Mechanic
Task library

Automatically mark new orders as ready for pickup

This task makes it easy for you to automatically mark new orders as 'Ready For Pickup' as soon as they come in. Ideal for stores that always have products in stock and want to speed up the pickup process.

Try this task

When it runs

Occurs whenever an order is created

What you choose

Pickup locations

Documentation

This task makes it easy for you to automatically mark new orders as 'Ready For Pickup' as soon as they come in. Ideal for stores that always have products in stock and want to speed up the pickup process.

This makes use of the fulfillmentOrderLineItemsPreparedForPickup GraphQL mutation.

This task was written with the help of ChatGPT-4, check out the conversation here.

Task code and subscriptions

You can edit the Liquid code after installing this task. View on GitHub or ask a question in the Mechanic Slack community.

Subscriptions

shopify/orders/create
How task subscriptions work

Option types and flags

Task code

{% if event.preview %}
  {% capture order %}
    {
      "fulfillment_orders": [
        {
          "id": 1,
          "assigned_location": {
            "name": {{ options.pickup_locations__array_required.first | json}}
          }
        },
        {
          "id": 2,
          "assigned_location": {
            "name": "Third Party Service"
          }
        }
      ]
    }
  {% endcapture %}

  {% assign order = order | parse_json %}
{% endif %}

{% assign pickup_locations = options.pickup_locations__array_required %}

{% for fulfillment_order in order.fulfillment_orders %}
  {% if pickup_locations contains fulfillment_order.assigned_location.name %}
    {% assign fulfillment_order_id = fulfillment_order.id %}
    {% assign fulfillment_order_graphql_id = "gid://shopify/FulfillmentOrder/" | append: fulfillment_order_id %}

    {% capture query %}
      mutation {
        fulfillmentOrderLineItemsPreparedForPickup(
          input: {
            lineItemsByFulfillmentOrder: [
              {
                fulfillmentOrderId: {{ fulfillment_order_graphql_id | json }}
              }
            ]
          }
        ) {
          userErrors {
            field
            message
          }
        }
      }
    {% endcapture %}

    {% action "shopify" %}
      {{ query | json }}
    {% endaction %}
  {% endif %}
{% endfor %}
Mechanic Liquid reference

Default option values

Pickup locations
["Your location name here"]