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

自定義結(jié)帳“下訂單"按鈕輸出html

Customizing checkout quot;Place Orderquot; button output html(自定義結(jié)帳“下訂單按鈕輸出html)
本文介紹了自定義結(jié)帳“下訂單"按鈕輸出html的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

我需要添加 Facebook Pixel 代碼來(lái)跟蹤事件,每次客戶(hù)點(diǎn)擊 WooCommerce 結(jié)賬頁(yè)面上的下訂單"時(shí).

我已嘗試在 Checkout 模板中找到按鈕行,并以這種方式對(duì)其進(jìn)行

但是我找不到按鈕的代碼.

如何添加代碼?
或者我在哪里可以找到編輯它的行?這是哪個(gè)模板?

謝謝

解決方案

如果您想對(duì)結(jié)帳提交按鈕進(jìn)行一些更改,您有兩種方法:

1) 使用掛在 woocommerce_order_button_html 過(guò)濾器鉤子中的自定義函數(shù),這樣:

add_filter('woocommerce_order_button_html', 'custom_order_button_html');函數(shù) custom_order_button_html( $button ) {//按鈕的文本$order_button_text = __('下訂單', 'woocommerce');//這里是你的 Javascript 事件$js_event = "fbq('track', 'AddPaymentInfo');";//在這里進(jìn)行更改(替換按鈕的代碼):$button = '<input type="submit" onClick="'.$js_event.'" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '"/>';返回 $ 按鈕;}

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

<小時(shí)>

2) 覆蓋模板 checkout/payment.php,您將定位此代碼(第 50 行):

<?php echo apply_filters( 'woocommerce_order_button_html', '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' .esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '"/>' );?>

改為:

' );?>

相關(guān)文檔:

  • I need to add the Facebook Pixel code to track an event, every time a client clicks the "Place Order" on the WooCommerce checkout page.

    I've tried to find the button line at the Checkout template, and edit it this way:

    <button onClick="fbq('track', 'AddPaymentInfo');">Place Order</button>
    

    But I can't locate the code for the button.

    How could I add the code?
    Or where can I find the line to edit it? Which template is it?

    Thanks

    解決方案

    If you want to make some changes on the checkout submit button, you will have 2 ways:

    1) Using a custom function hooked in woocommerce_order_button_html filter hook, this way:

    add_filter( 'woocommerce_order_button_html', 'custom_order_button_html');
    function custom_order_button_html( $button ) {
    
        // The text of the button
        $order_button_text = __('Place order', 'woocommerce');
    
        // HERE your Javascript Event
        $js_event = "fbq('track', 'AddPaymentInfo');";
    
        // HERE you make changes (Replacing the code of the button):
        $button = '<input type="submit" onClick="'.$js_event.'" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />';
    
        return $button;
    }
    

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


    2) Overriding the template checkout/payment.php and you will target this code (on line 50):

    <?php echo apply_filters( 'woocommerce_order_button_html', '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' ); ?>
    

    Changed to this:

    <?php 
        // Set HERE your javascript event
        $js_event = $js_event = "fbq('track', 'AddPaymentInfo');";
    
        echo apply_filters( 'woocommerce_order_button_html', '<input type="submit" onClick="'.$js_event.'" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' ); ?>
    

    Related documentation:

    • Template Structure + Overriding Templates via a Theme
    • Woocommerce templates file checkout/payment.php

    All code is tested and works. here is the output for both solutions:

    這篇關(guān)于自定義結(jié)帳“下訂單"按鈕輸出html的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產(chǎn)品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產(chǎn)品的總訂單數(shù))
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話(huà)字段驗(yàn)證問(wèn)題中添加自定義注冊(cè)字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡(jiǎn)單產(chǎn)品中添加一個(gè)將更改價(jià)格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產(chǎn)品列表)
Add birthday field to WooCommerce my account and admin user page(將生日字段添加到 WooCommerce 我的帳戶(hù)和管理員用戶(hù)頁(yè)面)
主站蜘蛛池模板: 天天夜碰日日摸日日澡 | 欧美精品在线一区 | 日韩精品免费一区二区在线观看 | 日韩av黄色 | 日韩免费一区二区 | wwwxx在线观看 | 亚洲精品视频在线看 | 久久精品视频9 | 久久99精品久久久久久国产越南 | 久久精品国产a三级三级三级 | 国产精品免费观看 | 一区二区三区视频在线 | 久久91精品国产一区二区 | 国产高清一区二区 | 国产精品一区二区在线 | 伊人精品在线 | 亚洲国产精品久久久久婷婷老年 | 在线激情视频 | 国产乱xxav | 欧美一区二区免费电影 | 欧美国产精品一区二区三区 | 毛片一级网站 | 亚洲欧洲在线视频 | 国产精品一区视频 | 91国语清晰打电话对白 | 精品国产一区二区三区四区在线 | 欧美一区二区三区久久精品 | 免费在线观看av的网站 | 日韩免费三级 | 日韩精品一区二区三区第95 | 久久久成人免费一区二区 | 操到爽| 免费亚洲婷婷 | 中文字幕精品一区二区三区在线 | 成人片免费看 | 国产成人一区二区三区 | 久久亚洲国产精品 | 欧美成人精品一区二区三区 | 奇米久久久 | 久久精品国产久精国产 | 99av成人精品国语自产拍 |