Following on from this question Commerce: How to update an order status via the frontend
We'd like to make it easy for delivery drivers to update the status of a craft commerce order, from a frontend page. Doing it via the CP on mobile is a bit cumbersome as it involves multiple steps.
We've created a user group call couriers.
{% extends '_layouts/_logistics' %}
{% block logistics %}
{% if currentUser and currentUser.isInGroup('courier') %}
{% include 'logistics/_orders' %}
{% else %}
{% redirect 'account' %}
{% endif %}
{% endblock %}
In the _orders include we'd like to show a list of orders, each with a 'Mark as Delivered' button, which can be clicked as the orders are fullfilled.
<dl>
{% if order.shippingAddress %}
{% include 'shop/_includes/addresses/address' with { address: order.shippingAddress } %}
{% endif %}
<dt>{{ order.reference }}</dt>
</dl>
<form method="POST">
<input type="hidden" name="action" value="">
{{ redirectInput('logistics') }}
{{ csrfInput() }}
<input type="hidden" name="orderStatusId" value="4">
<input class="button button--primary" type="submit" value='Mark as Delivered'>
</form>
I'm wondering if this can be done, without the need to build a plugin or module? Else is there a plan to include the ability to do this in a future Craft Commerce release.
Many thanks,
Andrew