Can you help me implement an invoice button on the account page? It is a new account setting, can you help me?
Hello @robertsolcan
use this code in your main-account.liquid file
{{ 'customer.css' | asset_url | stylesheet_tag }}
{%- style -%}
.section-{{ section.id }}-padding {
padding-top: {{ section.settings.padding_top | times: 0.75 | round: 0 }}px;
padding-bottom: {{ section.settings.padding_bottom | times: 0.75 | round: 0 }}px;
}
@media screen and (min-width: 750px) {
.section-{{ section.id }}-padding {
padding-top: {{ section.settings.padding_top }}px;
padding-bottom: {{ section.settings.padding_bottom }}px;
}
}
{%- endstyle -%}
# {{ 'customer.account.title' | t }}
{{ 'customer.log_out' | t }}
## {{ 'customer.orders.title' | t }}
{% paginate customer.orders by 20 %}
{%- if customer.orders.size > 0 -%}
{%- for order in customer.orders -%}
{%- endfor -%}
| {{ 'customer.orders.order_number' | t }} | {{ 'customer.orders.date' | t }} | {{ 'customer.orders.payment_status' | t }} | <br> {{ 'customer.orders.fulfillment_status' | t }}<br> | {{ 'customer.orders.total' | t }} | Invoice |
| - | - | - | - | - | - |
| <br> <br> {{ order.name }}<br> <br> | <br> {{ order.created_at | time_tag: format: 'date' }}<br> | <br> {{ order.financial_status_label }}<br> | <br> {{ order.fulfillment_status_label }}<br> | <br> {{ order.total_net_amount | money_with_currency }}<br> <br> <br> | <br> <br><br> {% if order.metafields.external.invoices != nil %}<br><br><br>One or more invoices available<br><br><br><br>{% assign invoices = order.metafields.external.invoices | parse_json %}<br>{% for invoice in invoices %}<br>- Invoice serial {{ invoice.serial }}, number {{ invoice.number }} <br>{% endfor %}<br><br><br>{% else %}<br>{% for attribute in order.attributes %}<br>{% if attribute.first == 'xconnector-invoice-short-url' %}<br><br><br>Download your invoice .<br><br><br>{% endif %}<br>{% endfor %}<br>{% endif %}<br> <br> |
{%- else -%}
{{ 'customer.orders.none' | t }}
{%- endif -%}
{%- if paginate.pages > 1 -%}
{%- if paginate.parts.size > 0 -%}
{%- endif -%}
{%- endif -%}
{% endpaginate %}
## {{ 'customer.account.details' | t }}
{{ customer.default_address | format_address }}
{{ 'customer.account.view_addresses' | t }} ({{ customer.addresses_count }})
{% schema %}
{
"name": "t:sections.main-account.name",
"settings": [
{
"type": "header",
"content": "t:sections.all.padding.section_padding_heading"
},
{
"type": "range",
"id": "padding_top",
"min": 0,
"max": 100,
"step": 4,
"unit": "px",
"label": "t:sections.all.padding.padding_top",
"default": 36
},
{
"type": "range",
"id": "padding_bottom",
"min": 0,
"max": 100,
"step": 4,
"unit": "px",
"label": "t:sections.all.padding.padding_bottom",
"default": 36
}
]
}
{% endschema %}
Please let me know Thanks