WordPress WooCommerce自定义支付网关开发问题

时间:2020-08-22 07:53:03

标签: php wordpress woocommerce

我想为我的付款网关设置标题,但是在结帐表格上没有出现标题。有什么方法可以设置一个选项来模仿设置保存,但只能用于一个选项(标题)吗?因为如果我在function glassSum(arr) { let maxSum = 0 for (let i = 0; i < 7; i++) { for (let j = 0; j < 7; j++) { const top = arr[i][j] + arr[i][j+1] const bottom = arr[i+1][j] + arr[i+1][j+1] const total = top + bottom if (total > maxSum) maxSum = total } } return maxSum } const a = [ [1,2,3,4,0,0,0,0], [1,2,3,4,0,0,0,0], [1,2,3,4,0,0,9,9], [1,2,3,4,0,0,9,9], [1,2,3,4,0,0,9,9], [1,2,3,4,0,0,9,9], [1,2,3,4,0,0,9,9], [1,2,3,4,0,0,9,9] ] console.log(glassSum(a)) 函数中设置(在结帐时加载),它将无法正常工作。

payment_fields

... \ wp-content \ plugins \ woocommerce \ templates \ checkout \ payment-method.php

function *****_init_payment_class() {
    ...
    class ****Payment extends WC_Payment_Gateway {
        ...
        public function payment_fields() {
            $res = $this->sendRequest('GET', "payment-service/view/$this->payment_service_id");
            if($res['_statusCode'] == 200) {
                $paymentService  = $res['data'];
                $this->title = $paymentService['name'];

所以基本上我在这里看到 <?php echo $ gateway-> get_title(); 代码,我希望我的标题在哪里。但实际上是空的。我想在payment_fields()挂钩/函数中设置标题。有办法吗?

enter image description here

0 个答案:

没有答案