You've already forked wc-tier-and-package-prices
Release version 1.0.1
- Add Twig template engine integration - Migrate all templates to Twig format - Add German (Switzerland, Informal) translation - Improve template organization and security - Add Composer dependency management - Create comprehensive changelog
This commit is contained in:
41
templates/frontend/tier-pricing-table.twig
Normal file
41
templates/frontend/tier-pricing-table.twig
Normal file
@@ -0,0 +1,41 @@
|
||||
{#
|
||||
# Frontend Tier Pricing Table Template
|
||||
#
|
||||
# @package WC_Tier_Package_Prices
|
||||
# @var object product
|
||||
# @var array tiers
|
||||
#}
|
||||
<div class="wc-tpp-tier-pricing-table">
|
||||
<h3>{{ 'Volume Discounts'|__('wc-tier-package-prices') }}</h3>
|
||||
<table class="wc-tpp-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ 'Quantity'|__('wc-tier-package-prices') }}</th>
|
||||
<th>{{ 'Price per Unit'|__('wc-tier-package-prices') }}</th>
|
||||
<th>{{ 'You Save'|__('wc-tier-package-prices') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set regular_price = product.get_regular_price() %}
|
||||
{% for tier in tiers %}
|
||||
{% set savings = 0 %}
|
||||
{% set savings_percent = 0 %}
|
||||
{% if regular_price > 0 %}
|
||||
{% set savings = regular_price - tier.price %}
|
||||
{% set savings_percent = (savings / regular_price) * 100 %}
|
||||
{% endif %}
|
||||
<tr data-min-qty="{{ tier.min_qty|esc_attr }}" data-price="{{ tier.price|esc_attr }}">
|
||||
<td>{{ tier.min_qty|esc_html }}+</td>
|
||||
<td>{{ wc_price(tier.price)|raw }}</td>
|
||||
<td>
|
||||
{% if savings > 0 %}
|
||||
{{ wc_price(savings)|raw }} ({{ savings_percent|round(2) }}%)
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
Reference in New Issue
Block a user