【发布时间】:2018-07-26 17:59:17
【问题描述】:
我需要交换我的 checkout-review-order-table 中的两行(税金和总价) - 我希望税金显示在总价上方,然后我需要在总价下方和附加行。
如果有可能解决functions.php中的问题,那就太好了
如果您需要任何其他信息,请告诉我。
感谢任何帮助。
【问题讨论】:
标签: php wordpress woocommerce checkout
我需要交换我的 checkout-review-order-table 中的两行(税金和总价) - 我希望税金显示在总价上方,然后我需要在总价下方和附加行。
如果有可能解决functions.php中的问题,那就太好了
如果您需要任何其他信息,请告诉我。
感谢任何帮助。
【问题讨论】:
标签: php wordpress woocommerce checkout
在 Woocommerce 结帐页面中,您需要覆盖模板 checkout/review-order.php via the theme。
您将不得不移动税块:
<?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
<?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
<tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
<th><?php echo esc_html( $tax->label ); ?></th>
<td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<tr class="tax-total">
<th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
<td><?php wc_cart_totals_taxes_total_html(); ?></td>
</tr>
<?php endif; ?>
<?php endif; ?>
在总块之后:
<?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
<tr class="order-total">
<th><?php _e( 'Total', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_order_total_html(); ?></td>
</tr>
<?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
<!-- #### ====> IN HERE <==== #### -->
它会很好地工作。用其他方式是不可能的。
【讨论】: