A user is struggling to center the “View your order” button in Shopify email templates. While style="text-align: center;" successfully centers the logo and other text elements, it doesn’t work on the button itself.
Proposed Solution:
Another user suggests that email HTML requires different styling approaches than web design. The recommended fix involves:
Adding align="center" to the <table> element wrapping the button
Adding style="text-align: center;" to the <td> element containing the button
Adding style="display: inline-block; text-align: center;" to the button’s <a> tag
The issue remains unresolved as the original poster hasn’t confirmed whether this solution worked.
Summarized with AI on October 31.
AI used: claude-sonnet-4-5-20250929.
I’ve been trying the last few days and searching google to find out how to centre buttons in the email templates which are send to customers. I can’t find anything. I’ve tried style=“text-align: center;” which works on the logo a the text that says ‘or visit our store’. However, this isn’t woking on ‘view your order’ button.
Here is my code;
{% capture email_title %}
{% if has_pending_payment %}
Thank you for your order!
{% else %}
Thank you for your order!
{% endif %}
{% endcapture %}
{% capture email_body %}
{% if has_pending_payment %}
{% if buyer_action_required %}
You’ll get a confirmation email after completing your payment.
{% else %}
Your payment is being processed. You’ll get an email when your order is confirmed.
{% endif %}
{% else %}
{% if requires_shipping %}
{% case delivery_method %}
{% when ‘pick-up’ %}
You’ll receive an email when your order is ready for pickup.
{% when ‘local’ %}
Hi {{ customer.first_name }}, we’re getting your order ready for delivery.
{% else %}
We’re getting your order ready to be shipped. We will notify you when it has been sent.
{% endcase %}
{% if delivery_instructions != blank %}
Delivery information: {{ delivery_instructions }}
{% endif %}
{% if consolidated_estimated_delivery_time %}
{% assign transaction_count = transactions | size %}
{% if transaction_count > 0 %}
{% for transaction in transactions %}
{% if transaction.show_buyer_pending_payment_instructions? %}
{{transaction.buyer_pending_payment_notice}}
{% for instruction in transaction.buyer_pending_payment_instructions %}
{% endfor %}
{% for instruction in transaction.buyer_pending_payment_instructions %}
{% endfor %}
{% if line.selling_plan_allocation %} {{ line.selling_plan_allocation.selling_plan.name }}
{% endif %}
{% if line.refunded_quantity > 0 %} Refunded
{% endif %}
{% if line.discount_allocations %}
{% for discount_allocation in line.discount_allocations %}
{% if discount_allocation.discount_application.target_selection != ‘all’ %}
{% if order_discount_count > 0 %}
{% if order_discount_count == 1 %}
{% endif %}
{% if order_discount_count > 1 %}
{% endif %}
{% for discount_application in discount_applications %}
{% if discount_application.target_selection == ‘all’ and discount_application.target_type != ‘shipping_line’ %}
{% if requires_shipping and shipping_address %}
{% endif %}
{% if billing_address %}
{% endif %}
Shipping address
{{ shipping_address | format_address }}
Billing address
{{ billing_address | format_address }}
{% if company_location %}
{% endif %}
{% if transaction_size > 0 or payment_terms and payment_terms.automatic_capture_at_fulfillment == false or b2b? %}
{% endif %}
{% if requires_shipping and shipping_address %}
{% if shipping_method %}
{% endif %}
{% endif %}
Location
{{ company_location.name }}
Payment
{% if payment_terms %}
{% assign due_date = payment_terms.next_payment.due_at | default: nil %}
{% if payment_terms.type == 'receipt' or payment_terms.type == 'fulfillment' and payment_terms.next_payment.due_at == nil %}
{{ payment_terms.translated_name }}
{% else %}
{{ payment_terms.translated_name }}: Due {{ due_date | date: format: 'date' }}
{% endif %}
{% endif %}
{% if transaction_size > 0 %}
{% for transaction in transactions %}
{% if transaction.status == "success" or transaction.status == "pending" %}
{% if transaction.kind == "capture" or transaction.kind == "sale" %}
{% if transaction.payment_details.credit_card_company %}
ending with {{ transaction.payment_details.credit_card_last_four_digits }}
{% elsif transaction.gateway_display_name == "Gift card" %}
ending with {{ transaction.payment_details.gift_card.last_four_characters | upcase }}
Gift card balance - {{ transaction.payment_details.gift_card.balance | money }}
{% elsif transaction.gateway_display_name != "Shop Cash" %}
{{ transaction.gateway_display_name }}
{% endif %}
{% elsif transaction.kind == "authorization" and transaction.gateway_display_name == "Shop Cash" %}
Shop Cash - {{ transaction.amount | money }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
Maybe email HTML is different from web design, so buttons need extra styling to align properly.
To center the “View your order” button in your Shopify email template, modify the containing the button by ensuring it has text-align: center;. Also, make sure the table wrapping the button is centered.