通过付款网关Woocommerce显示订单

时间:2019-11-05 18:21:38

标签: woocommerce

我在帐户页面上创建了一个新标签

我要在此新标签中致电所有通过银行转帐付款的订单

首先,我创建一个显示订单的简码:

import requests
import json

params = {
    "grant_type": "password",
    "client_id": "client_id", # Consumer Key
    "client_secret": "client_secret", # Consumer Secret
    "username": "username", # The email you use to login
    "password": "password + unique_security_key"}

headers = {'content_type':'application/x-www-form-urlencoded'}

r = requests.post("https://login.salesforce.com/services/oauth2/token", params=params, headers=headers)
access_token = r.json().get("access_token")
instance_url = r.json().get("instance_url")
print("Access Token:", access_token)
print("Instance URL", instance_url)

然后我通过如下付款方式进行过滤:

function shortcode_my_orders( $atts ) {
    extract( shortcode_atts( array(
        'order_count' => -1
    ), $atts ) );

    ob_start();
    wc_get_template( 'myaccount/my-orders.php', array(
        'current_user'  => get_user_by( 'id', get_current_user_id() ),
        'order_count'   => $order_count
    ) );
    return ob_get_clean();
}
add_shortcode('my_orders', 'shortcode_my_orders');

但这不起作用

0 个答案:

没有答案