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

如何在 WooCommerce 訂單完成頁面中插入 Google Merc

How to insert Google Merchant Review JS code in WooCommerce Order Complete page(如何在 WooCommerce 訂單完成頁面中插入 Google Merchant Review JS 代碼)
本文介紹了如何在 WooCommerce 訂單完成頁面中插入 Google Merchant Review JS 代碼的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我想完成 Google Merchant Review 代碼要求在結賬頁面完成的變量:

I want to complete the variables the Google Merchant Review codes asks to be completed on the checkout page:

<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>

<script>
  window.renderOptIn = function() {
    window.gapi.load('surveyoptin', function() {
      window.gapi.surveyoptin.render(
        {
          "merchant_id": mymerchantid,
          "order_id": "ORDER_ID",
          "email": "CUSTOMER_EMAIL",
          "delivery_country": "COUNTRY_CODE",
          "estimated_delivery_date": "YYYY-MM-DD"
        });
    });
  }
</script>

我需要echo以下變量:

ORDER_ID:WooCommerce 訂單 ID 的 ID 號

ORDER_ID: ID number of the WooCommerce order ID

CUSTOMER_EMAIL:訂單的客戶信息部分中列出的電子郵件

CUSTOMER_EMAIL: The email listed in the customer information section of the order

DELIVERY_COUNTRY:我想我可以用 ES 填充它,因為我只在西班牙銷售

DELIVERY_COUNTRY: I think I can just fill it with ES since I only sell in Spain

ESTIMATED_DELIVERY_DATE:我已經有了一個用來計算發貨日期的函數,所以我想我可以在這里使用那個 php 函數.

ESTIMATED_DELIVERY_DATE: I already have a function I use to calculate the shipping date, so I guess I can use that php function here.

總而言之,我需要幫助弄清楚如何在結帳頁面中回顯 ORDER_IDCUSTOMER_EMAIL,具體地在所述腳本內部.我對如何做到這一點一無所知,因為我所做的一切都帶來了災難性的結果

In conclusion, I would need help figuring out how do I echo the ORDER_ID and CUSTOMER_EMAIL in the checkout page, concretely inside of said script. I'm kind of clueless on how to do so, since all I tried had kind of a catastrophic result

非常感謝您的閱讀!

TL;DR:我如何在付款后結帳時echoORDER_IDCUSTOMER_EMAILWooCommerce 上的頁面?

TL;DR: How do I get to echo the ORDER_ID and CUSTOMER_EMAIL in the after payment checkout page on WooCommerce?

推薦答案

如果您想在訂單中添加 JavaScript 目標轉化代碼完成或Thankyou頁面然后你必須使用woocommerce_thankyou 鉤子.

代碼如下:

function wh_CustomReadOrder($order_id) {
    //getting order object
    $order = wc_get_order($order_id);
    $email = $order->billing_email;
    ?>
    <script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>
    <script>
        window.renderOptIn = function () {
            window.gapi.load('surveyoptin', function () {
                window.gapi.surveyoptin.render(
                        {
                            "merchant_id": mymerchantid,
                            "order_id": "<?php echo $order_id; ?>",
                            "email": "<?php echo $email; ?>",
                            "delivery_country": "COUNTRY_CODE",
                            "estimated_delivery_date": "YYYY-MM-DD"
                        }
                );
            });
        };
    </script>
    <?php
}

add_action('woocommerce_thankyou', 'wh_CustomReadOrder');

代碼位于活動子主題(或主題)的 functions.php 文件中.或者也可以在任何插件 PHP 文件中.
代碼已經過測試并且可以正常工作.

Code goes in functions.php file of your active child theme (or theme). Or also in any plugin PHP files.
Code is tested and works.

參考:

  • 官方文檔

相關問題

  • Woocommerce 在感謝頁面上獲取訂單并傳遞數據 javascript 代碼段
  • Woocommerce:檢查成功購買的是新客戶還是回頭客

希望這有幫助!

這篇關于如何在 WooCommerce 訂單完成頁面中插入 Google Merchant Review JS 代碼的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產品的總訂單數)
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話字段驗證問題中添加自定義注冊字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡單產品中添加一個將更改價格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結帳“下訂單按鈕輸出html)
主站蜘蛛池模板: 日韩二区三区 | 欧美午夜精品 | 欧美性受xxxx | 99re视频在线 | 国产精品乱码一区二区三区 | 国产男女视频 | 青草福利 | 亚洲一区中文 | 久热久 | 欧美国产中文字幕 | 国产91色在线 | 亚洲 | 99亚洲精品视频 | 欧美激情国产精品 | 噜啊噜在线 | 免费看欧美一级片 | 亚洲视频三区 | 欧洲一级黄 | 国产精品视频免费观看 | 日日人人 | 国产成人精品综合 | 欧美午夜久久 | 99精品视频免费观看 | 中文字幕亚洲视频 | 久久免费精彩视频 | 日批日韩在线观看 | 中文在线播放 | 伊人色综合久久天天五月婷 | 91麻豆精品一区二区三区 | 草b视频| 色综合99 | 成人福利在线 | 精品久久一区 | 天天干,夜夜操 | 成人亚洲性情网站www在线观看 | 日韩欧美在线观看 | 日韩伦理一区二区 | 欧美在线看片 | h视频在线观看免费 | 久久四虎 | 人人干人人干人人 | 欧美亚洲国产一区 |