User-generated invoice numbers

Sufio allows you to generate your invoice numbering for invoices that are automatically created from orders in your Shopify store. These invoice numbers can be specified by the customer that places the order or the products that the order contains.

By adding a unique cart attribute Invoice Number to the cart page, you can set user-generated invoice numbers for invoices created from a specific type of orders.

For example, the cart attribute in this code snippet will set the invoice number to 1420.

<input type="hidden" name="attributes[Invoice Number]" id="invoice-number" value="1420" />

To add the cart attribute to the cart page:

  1. In your Shopify Admin, go to the Online Store Themes page.
  2. Click the Actions button, and then click Edit code.
  3. Select cart.liquid in the left sidebar. You might use the upper search bar for a faster search.
  4. Insert the following code snippet inside the <form>. The right place for the field is just before the Check out button.

Here is an example code snippet that sets invoice numbers with a custom prefix (taken from customer tag) and an incremental number. Please note that this only works for customers logged into their accounts while shopping on your online store.

<!-- Shopify cart page -- set custom invoice number to customer tag and an incremental number. Used by Sufio for Shopify (sufio.com/shopify/invoice). -->
{% if customer %}
  {% capture invoice_number %}{{ customer.tags | first }}{{ customer.orders | size | plus:1 }}{% endcapture %}
  <input type="hidden" name="attributes[Invoice Number]" id="invoice-number" value="{{ invoice_number }}" />
{% endif %}

Note

If your store uses cart drawer (also called ajax cart), this code snippet needs to be added to a different file than cart.liquid. In most cases, it needs to be added to ajax-cart-template.liquid file.

Need help?

Do you need help with customizing your Shopify store theme? Please contact our experienced support team. We'll be happy to assist!