久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

自定義文本“總計(jì)"在 WooCommerce 結(jié)帳頁面中

Customize the text quot;Totalquot; in WooCommerce checkout page(自定義文本“總計(jì)在 WooCommerce 結(jié)帳頁面中)
本文介紹了自定義文本“總計(jì)"在 WooCommerce 結(jié)帳頁面中的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我想將結(jié)帳頁面中的Total"文本更改為Totalinkl.vat".我嘗試過不同的事情但沒有成功......

I would like to change the the "Total" text in my checkout page to "Total inkl. vat". I have tried different things without success…

這是我的目標(biāo):

<?php _e( 'Total', 'woocommerce' ); ?>

這是代碼片段.我搜索了所有語言文件,但找不到任何內(nèi)容.我已經(jīng)安裝了 Q 翻譯插件,但我認(rèn)為這不是問題.

This is the code snippet. I've searched in all language files but i can't find anything. I've installed the Q translate plugin but I don't think it's the problem.

我可以編碼很困難,但這不是一個(gè)好的解決方案,因?yàn)槲冶仨氃谖业乃形募羞M(jìn)行此編輯.

I could code it hard, but thats not a good solution because I've to do this edit in all my files.

請(qǐng)問我怎樣才能做到這一點(diǎn)?

How can I achieve this please?

謝謝

推薦答案

OPTION 1 (最佳選擇)

覆蓋woocommerce checkout/review-order.php 模板.

Overriding the woocommerce checkout/review-order.php template.

您首先需要(如果沒有完成)復(fù)制templates 位于 的子文件夾>woocommerce 插件文件夾到您的活動(dòng)子主題(或主題)文件夾,并將其重命名為 woocommerce.

You need first (if not done) to copy the templates sub folder located in in woocommerce plugin folder to your active child theme (or theme) folde, and rename it woocommerce.

在您的活動(dòng)主題中完成后,轉(zhuǎn)到 woocommerce >結(jié)帳,然后打開/編輯review-order.php 模板文件.

Once done in your active theme go to woocommerce > checkout, and open/edit review-order.php template file.

在此模板的末尾,您會(huì)看到:

At the end of this template you have this:

        <?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' ); ?>

    </tfoot>
</table>

所以你會(huì)改變:

<th><?php _e( 'Total', 'woocommerce' ); ?></th>

致:

<th><?php _e( 'Total inkl. vat', 'woocommerce' ); ?></th>

現(xiàn)在你可以保存了,你完成了……

Now you can save, you are done…

參考文獻(xiàn):

  • 模板結(jié)構(gòu) + 通過主題覆蓋模板
  • Woocommerce 模板結(jié)帳 > 審查訂單.php

選項(xiàng) 2 (不理想,見下文)

你可以使用 wordpress gettex() 用于此目的的本機(jī)函數(shù),如下所示:

You could use wordpress gettex() native function for that purpose, this way:

add_filter('gettext', 'wc_renaming_checkout_total', 20, 3);
function wc_renaming_checkout_total( $translated_text, $untranslated_text, $domain ) {

    if( !is_admin() && is_checkout ) {
        if( $untranslated_text == 'Total' )
            $translated_text = __( 'Total inkl. vat','theme_slug_domain' );
    }
    return $translated_text;
}

此代碼位于活動(dòng)子主題(或主題)的 function.php 文件或任何插件文件中.

This code goes in function.php file of your active child theme (or theme) or also in any plugin file.

但是你會(huì)在價(jià)格表中得到2個(gè)自定義文本,因?yàn)橛?個(gè)"Total"文本(一次在產(chǎn)品"之后的第一行)和最后一次......

But you will get 2 customized texts in the prices table, because there is 2 "Total" texts (once in the first line after 'Products') and one time at the end…

此代碼已經(jīng)過測(cè)試且有效.

這篇關(guān)于自定義文本“總計(jì)"在 WooCommerce 結(jié)帳頁面中的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Session is lost after an OAuth redirect(OAuth 重定向后會(huì)話丟失)
Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分頁排序)
CakePHP Shared core for multiple apps(CakePHP 多個(gè)應(yīng)用程序的共享核心)
Login [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登錄 [ Auth-identify() ] 始終為 false)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命錯(cuò)誤:允許的內(nèi)存大小為 134217728 字節(jié)已用盡(嘗試分配 87 字節(jié)))
主站蜘蛛池模板: 性一交一乱一透一a级 | 亚洲精品一区二区三区蜜桃久 | 日韩av在线一区二区 | 91av视频在线免费观看 | 亚洲首页 | 久草中文网 | 国产精品视频500部 a久久 | 日本粉嫩一区二区三区视频 | 国产精品观看 | 久久精品亚洲精品国产欧美 | 国产视频中文字幕 | 成人在线电影在线观看 | 成人av电影网 | 日韩在线小视频 | 不卡的av一区 | 久久国产精品-久久精品 | 久久精品成人 | 国产在线网站 | 成人a网| 日韩一区二 | 久久99精品久久久久久国产越南 | 人人做人人澡人人爽欧美 | 亚洲欧美激情精品一区二区 | 婷婷福利视频导航 | 色综合一区二区三区 | 欧美精品久久 | 中国毛片免费 | www.久久| 91精品国产综合久久久动漫日韩 | 午夜激情国产 | 中文字幕人成乱码在线观看 | 一级毛片色一级 | 国产超碰人人爽人人做人人爱 | a网站在线观看 | 亚洲一级二级三级 | 亚洲成人在线视频播放 | 亚洲福利 | 欧美一级毛片免费观看 | 久久久久久久久久久久久久久久久久久久 | 99免费在线观看视频 | 免费成人在线网 |