How to add cancel order to order.liquid?

civiva
New Member
5 0 0

Hi everyone,

I am currently working on to add 'cancel order' functionality to order.liquid.

I want to give customers more options to interact with their order(Ex: reorder, leave feedback, cancel, return...).

So far I was able to add reorder as such:

{% for line_item in order.line_items %}
              <tr>
                <td><a href="/cart/{{ line_item.variant_id }}:{{ line_item.quantity }}">Reorder Item</a></td>
              </tr>
{%endfor %}
I just need some help with 'cancel order'. If anyone could point me in right direction, that would be really helpful.
Thanks
0 Likes
soulchild37
Tourist
7 1 1

Hi civiva,

For cancelling order, you would need to call Shopify API (https://shopify.dev/docs/admin-api/rest/reference/orders/order#cancel-2021-01), using your store credentials.

If you don't want to deal with Shopify API, I have made an app named Cancellable (https://apps.shopify.com/cancellable) to do this exact function for you, feel free to give it a try!

demodemo

Cheers,

Axel

0 Likes