{# Trust Badge Components ====================== Trust signals and security indicators for e-commerce. Usage: {% from 'shared/macros/shop/trust-badges.html' import trust_badges, trust_banner, payment_icons, guarantee_badge %} #} {# Trust Badges ============ Grid of trust indicators. Parameters: - badges: List of badge types to show (default: all) - layout: 'grid' | 'inline' | 'vertical' (default: 'grid') - size: 'sm' | 'md' | 'lg' (default: 'md') - show_text: Show badge text (default: true) - free_shipping_threshold: Threshold for free shipping (default: none) Badge Types: - secure_payment - free_shipping - easy_returns - support_24_7 - money_back - ssl_secured - fast_delivery - quality_guarantee Usage: {{ trust_badges(badges=['secure_payment', 'free_shipping', 'easy_returns']) }} {{ trust_badges(layout='inline', size='sm') }} #} {% macro trust_badges( badges=none, layout='grid', size='md', show_text=true, free_shipping_threshold=none ) %} {% set all_badges = [ { 'id': 'secure_payment', 'icon': 'lock-closed', 'title': 'Secure Payment', 'description': '256-bit SSL encryption' }, { 'id': 'free_shipping', 'icon': 'truck', 'title': 'Free Shipping', 'description': 'On orders over $' ~ (free_shipping_threshold or 50) }, { 'id': 'easy_returns', 'icon': 'refresh', 'title': 'Easy Returns', 'description': '30-day return policy' }, { 'id': 'support_24_7', 'icon': 'support', 'title': '24/7 Support', 'description': 'Always here to help' }, { 'id': 'money_back', 'icon': 'cash', 'title': 'Money Back', 'description': '100% guarantee' }, { 'id': 'ssl_secured', 'icon': 'shield-check', 'title': 'SSL Secured', 'description': 'Protected checkout' }, { 'id': 'fast_delivery', 'icon': 'lightning-bolt', 'title': 'Fast Delivery', 'description': '2-5 business days' }, { 'id': 'quality_guarantee', 'icon': 'badge-check', 'title': 'Quality Guarantee', 'description': 'Premium products' } ] %} {% set selected_badges = badges if badges else ['secure_payment', 'free_shipping', 'easy_returns', 'support_24_7'] %} {% set sizes = { 'sm': {'icon': 'w-5 h-5', 'title': 'text-xs', 'desc': 'text-xs', 'padding': 'p-2', 'gap': 'gap-1'}, 'md': {'icon': 'w-6 h-6', 'title': 'text-sm', 'desc': 'text-xs', 'padding': 'p-3', 'gap': 'gap-2'}, 'lg': {'icon': 'w-8 h-8', 'title': 'text-base', 'desc': 'text-sm', 'padding': 'p-4', 'gap': 'gap-3'} } %} {% set layouts = { 'grid': 'grid grid-cols-2 md:grid-cols-4 gap-4', 'inline': 'flex flex-wrap items-center justify-center gap-6', 'vertical': 'flex flex-col gap-3' } %}
{% for badge_id in selected_badges %} {% for badge in all_badges %} {% if badge.id == badge_id %}
{% if show_text %}

{{ badge.title }}

{% if layout != 'inline' %}

{{ badge.description }}

{% endif %}
{% endif %}
{% endif %} {% endfor %} {% endfor %}
{% endmacro %} {# Trust Banner ============ Full-width trust banner for product pages or checkout. Parameters: - variant: 'default' | 'compact' | 'detailed' (default: 'default') - show_icons: Show payment/security icons (default: true) Usage: {{ trust_banner() }} {{ trust_banner(variant='compact') }} #} {% macro trust_banner( variant='default', show_icons=true ) %} {% if variant == 'compact' %}
Free shipping over $50 30-day returns Secure checkout
{% elif variant == 'detailed' %}

Free Shipping

On all orders over $50. International shipping available.

Easy Returns

30-day hassle-free return policy. No questions asked.

Secure Payment

Your payment info is protected with 256-bit encryption.

{% if show_icons %}
{{ payment_icons(size='sm') }}
{% endif %}
{% else %} {# Default variant #}

Secure Shopping Guarantee

Shop with confidence - your data is protected

{% if show_icons %} {{ payment_icons(size='sm') }} {% endif %}
{% endif %} {% endmacro %} {# Payment Icons ============= Display accepted payment method icons. Parameters: - methods: List of payment methods (default: common cards) - size: 'xs' | 'sm' | 'md' | 'lg' (default: 'md') - grayscale: Show in grayscale (default: false) Methods: visa, mastercard, amex, paypal, apple_pay, google_pay, discover, klarna Usage: {{ payment_icons() }} {{ payment_icons(methods=['visa', 'mastercard', 'paypal'], size='lg') }} #} {% macro payment_icons( methods=none, size='md', grayscale=false ) %} {% set all_methods = { 'visa': {'name': 'Visa', 'color': 'text-blue-600'}, 'mastercard': {'name': 'Mastercard', 'color': 'text-orange-500'}, 'amex': {'name': 'American Express', 'color': 'text-blue-500'}, 'paypal': {'name': 'PayPal', 'color': 'text-blue-700'}, 'apple_pay': {'name': 'Apple Pay', 'color': 'text-gray-900 dark:text-white'}, 'google_pay': {'name': 'Google Pay', 'color': 'text-gray-700'}, 'discover': {'name': 'Discover', 'color': 'text-orange-600'}, 'klarna': {'name': 'Klarna', 'color': 'text-pink-500'} } %} {% set selected = methods if methods else ['visa', 'mastercard', 'amex', 'paypal'] %} {% set sizes = { 'xs': 'h-4', 'sm': 'h-6', 'md': 'h-8', 'lg': 'h-10' } %}
{% for method in selected %} {% if method in all_methods %}
{{ all_methods[method].name[:4] }}
{% endif %} {% endfor %}
{% endmacro %} {# Guarantee Badge =============== Individual guarantee/warranty badge. Parameters: - type: 'money_back' | 'warranty' | 'authentic' | 'satisfaction' (default: 'money_back') - days: Number of days (for money_back/warranty) - size: 'sm' | 'md' | 'lg' (default: 'md') - variant: 'default' | 'outlined' | 'filled' (default: 'default') Usage: {{ guarantee_badge(type='money_back', days=30) }} {{ guarantee_badge(type='warranty', days=365, variant='filled') }} #} {% macro guarantee_badge( type='money_back', days=30, size='md', variant='default' ) %} {% set badges = { 'money_back': { 'icon': 'cash', 'title': days ~ '-Day Money Back', 'subtitle': 'Guarantee' }, 'warranty': { 'icon': 'shield-check', 'title': (days // 365) ~ '-Year Warranty' if days >= 365 else days ~ '-Day Warranty', 'subtitle': 'Included' }, 'authentic': { 'icon': 'badge-check', 'title': '100% Authentic', 'subtitle': 'Guaranteed' }, 'satisfaction': { 'icon': 'emoji-happy', 'title': 'Satisfaction', 'subtitle': 'Guaranteed' } } %} {% set badge = badges[type] %} {% set sizes = { 'sm': {'icon': 'w-8 h-8', 'title': 'text-xs', 'subtitle': 'text-xs', 'padding': 'p-3'}, 'md': {'icon': 'w-10 h-10', 'title': 'text-sm', 'subtitle': 'text-xs', 'padding': 'p-4'}, 'lg': {'icon': 'w-12 h-12', 'title': 'text-base', 'subtitle': 'text-sm', 'padding': 'p-5'} } %} {% set variants = { 'default': 'bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700', 'outlined': 'border-2 border-purple-600 dark:border-purple-400', 'filled': 'bg-purple-600 text-white' } %}

{{ badge.title }}

{{ badge.subtitle }}

{% endmacro %} {# Security Seals ============== Security certification seals. Parameters: - seals: List of seal types to show - layout: 'horizontal' | 'vertical' (default: 'horizontal') Seal Types: ssl, pci, mcafee, norton, trustpilot Usage: {{ security_seals(seals=['ssl', 'pci']) }} #} {% macro security_seals( seals=none, layout='horizontal' ) %} {% set all_seals = [ {'id': 'ssl', 'name': 'SSL Secure', 'icon': 'lock-closed'}, {'id': 'pci', 'name': 'PCI Compliant', 'icon': 'shield-check'}, {'id': 'verified', 'name': 'Verified Business', 'icon': 'badge-check'}, {'id': 'secure_checkout', 'name': 'Secure Checkout', 'icon': 'shield-check'} ] %} {% set selected = seals if seals else ['ssl', 'verified'] %}
{% for seal_id in selected %} {% for seal in all_seals %} {% if seal.id == seal_id %}
{{ seal.name }}
{% endif %} {% endfor %} {% endfor %}
{% endmacro %} {# Checkout Trust Section ====================== Combined trust elements for checkout pages. Parameters: - show_guarantee: Show money-back guarantee (default: true) - show_payment: Show payment icons (default: true) - show_security: Show security seals (default: true) Usage: {{ checkout_trust_section() }} #} {% macro checkout_trust_section( show_guarantee=true, show_payment=true, show_security=true ) %}
{% if show_guarantee %}

100% Secure Checkout

Your payment information is encrypted and secure. We never store your card details.

{% endif %} {% if show_payment %}

We accept:

{{ payment_icons(size='md') }}
{% endif %} {% if show_security %}
{{ security_seals() }}
{% endif %}
256-bit SSL 30-day returns 24/7 support
{% endmacro %}