You've already forked wc-bootstrap
79 lines
3.8 KiB
Twig
79 lines
3.8 KiB
Twig
|
|
{#
|
||
|
|
# Payment Methods (Bootstrap 5 Override)
|
||
|
|
#
|
||
|
|
# Shows saved payment methods on the account page.
|
||
|
|
#
|
||
|
|
# WooCommerce PHP equivalent: myaccount/payment-methods.php
|
||
|
|
#
|
||
|
|
# @package WcBootstrap
|
||
|
|
# @since 0.1.0
|
||
|
|
#}
|
||
|
|
|
||
|
|
{% set saved_methods = wc_get_customer_saved_methods_list(get_current_user_id()) %}
|
||
|
|
{% set has_methods = saved_methods is not empty %}
|
||
|
|
|
||
|
|
{{ do_action('woocommerce_before_account_payment_methods', has_methods) }}
|
||
|
|
|
||
|
|
{% if has_methods %}
|
||
|
|
<div class="table-responsive">
|
||
|
|
<table class="table table-hover align-middle mb-4">
|
||
|
|
<thead class="table-light">
|
||
|
|
<tr>
|
||
|
|
{% for column_id, column_name in wc_get_account_payment_methods_columns() %}
|
||
|
|
<th>{{ column_name|esc_html }}</th>
|
||
|
|
{% endfor %}
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
{% for type, methods in saved_methods %}
|
||
|
|
{% for method in methods %}
|
||
|
|
<tr class="{% if method.is_default|default(false) %}table-active{% endif %}">
|
||
|
|
{% for column_id, column_name in wc_get_account_payment_methods_columns() %}
|
||
|
|
<td data-title="{{ column_name|esc_attr }}">
|
||
|
|
{% if column_id == 'method' %}
|
||
|
|
{% if method.method.last4 is defined and method.method.last4 %}
|
||
|
|
{{ __('%1$s ending in %2$s')|format(wc_get_credit_card_type_label(method.method.brand)|esc_html, method.method.last4|esc_html) }}
|
||
|
|
{% else %}
|
||
|
|
{{ wc_get_credit_card_type_label(method.method.brand)|esc_html }}
|
||
|
|
{% endif %}
|
||
|
|
{% if method.is_default|default(false) %}
|
||
|
|
<span class="badge text-bg-primary ms-1">{{ __('Default') }}</span>
|
||
|
|
{% endif %}
|
||
|
|
{% elseif column_id == 'expires' %}
|
||
|
|
{{ method.expires|esc_html }}
|
||
|
|
{% elseif column_id == 'actions' %}
|
||
|
|
<div class="btn-group btn-group-sm" role="group">
|
||
|
|
{% for key, action in method.actions %}
|
||
|
|
<a href="{{ action.url|esc_url }}"
|
||
|
|
class="btn btn-outline-primary {{ key }}">
|
||
|
|
{{ action.name|esc_html }}
|
||
|
|
</a>
|
||
|
|
{% endfor %}
|
||
|
|
</div>
|
||
|
|
{% else %}
|
||
|
|
{{ do_action('woocommerce_account_payment_methods_column_' ~ column_id, method) }}
|
||
|
|
{% endif %}
|
||
|
|
</td>
|
||
|
|
{% endfor %}
|
||
|
|
</tr>
|
||
|
|
{% endfor %}
|
||
|
|
{% endfor %}
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
{% else %}
|
||
|
|
<div class="alert alert-info" role="alert">
|
||
|
|
<i class="bi bi-info-circle me-2" aria-hidden="true"></i>
|
||
|
|
{{ __('No saved methods found.') }}
|
||
|
|
</div>
|
||
|
|
{% endif %}
|
||
|
|
|
||
|
|
{{ do_action('woocommerce_after_account_payment_methods', has_methods) }}
|
||
|
|
|
||
|
|
{% if fn('WC').payment_gateways.get_available_payment_gateways() is not empty %}
|
||
|
|
<a href="{{ wc_get_endpoint_url('add-payment-method')|esc_url }}" class="btn btn-outline-primary">
|
||
|
|
<i class="bi bi-plus-lg me-1" aria-hidden="true"></i>
|
||
|
|
{{ __('Add payment method') }}
|
||
|
|
</a>
|
||
|
|
{% endif %}
|