小编Tom*_*son的帖子

通过 API 从 WooCommerce 向外部系统发送订单详细信息

我正在尝试通过我编写的外部 api 将 woocommerce 订单发送到 netsuite。我是 woocommerce 的新手,并没有完全了解如何添加此功能。

我已将以下代码添加到public_html/wp-content/themes/reverie-master/ 中的functions.php 文件中

add_action( 'woocommerce_payment_complete'', 'wdm_send_order_to_ext'); 
function wdm_send_order_to_ext( $order_id ){
// get order object and order details
$order = new WC_Order( $order_id ); 
$email = $order->billing_email;
$phone = $order->billing_phone;

//Create the data object
$orderData = array(
    'customer_email' => $email,
    'customer_phone' => $phone
);

$apiData = array(
    'caller' => 'woocommerce',
    'json' => $orderData,
    'key' => 'MY_SECRET_KEY'
);

$jsonData =json_encode($orderData);

$url = "";
$api_mode = 'sandbox';
if($api_mode == 'sandbox'){
    // sandbox URL …
Run Code Online (Sandbox Code Playgroud)

netsuite woocommerce

6
推荐指数
1
解决办法
1993
查看次数

Discord Login API 重定向到带有动态查询字符串的 URL

发生什么了?

使用 Discord API 登录网站后,用户将返回到重定向 URL。

我想要发生的事情

使用 Discord API 登录网站后,用户将返回到他们所在的页面,包括任何查询字符串。{完整网址}/post.php?postid={some_post_id}

在我对此进行测试期间,该 API 似乎需要一个精确的重定向 url。但是因为我使用 postid 加载帖子,所以我无法添加所有可能的重定向 url?这是怎么做的?

discord

3
推荐指数
1
解决办法
331
查看次数

在 SuiteScript 中获取客户的送货和帐单地址

我正在尝试在 SuiteScript 中获取客户的默认送货和帐单地址。

    var shipaddress = null;
    var billaddress = null;

    //Find the default billing and shipping addresses
    var add_Count = customerRec.getLineCount('addressbook');
    for (var i = 1; i <= add_Count; i++){
        customerRec.selectLine('addressbook', i);
        var def_Bill = customerRec.getCurrentSublistValue('addressbook', 'defaultbilling');
        var def_Ship = customerRec.getCurrentSublistValue('addressbook', 'defaultshipping');
        if(def_Bill){
            billaddress = customerRec.getCurrentSublistSubrecord('addressbook', 'addressbookaddress');
        } else if(def_Ship){
            shipaddress = customerRec.getCurrentSublistSubrecord('addressbook', 'addressbookaddress');
        }
    }
Run Code Online (Sandbox Code Playgroud)

通过这段代码,我可以获得第一个,但是一旦它命中

customerRec.selectLine('addressbook', i);
Run Code Online (Sandbox Code Playgroud)

第二次它抛出错误。

SSS_INVALID_SUBLIST_OPERATION
You have attempted an invalid sublist or line item operation. You are either trying to access a field …
Run Code Online (Sandbox Code Playgroud)

suitescript2.0

2
推荐指数
1
解决办法
2253
查看次数

SuiteScript2.0 从保存的搜索公式列中获取值

我正在尝试从保存的搜索中的公式字段获取值。我正在获取所有结果,然后这样循环它们。

for(key in itemReplenishResults){
    log.debug("Single Data", JSON.stringify(itemReplenishResults[key]));
    var thisNumber = Number(itemReplenishResults[key].getValue("formulanumeric_1"))
}
Run Code Online (Sandbox Code Playgroud)

正如我所期望的那样读取单个数据的日志;

{
    "recordType": "inventoryitem",
    "id": "2131",
    "values": {
        "itemid": "ITEMCODE",
        "displayname": "DISPLAYNAME",
        "salesdescription": "SALESDESCRIPTION",
        "type": [
            {
                "value": "InvtPart",
                "text": "Inventory Item"
            }
        ],
        "location": [],
        "locationquantityonhand": "",
        "locationreorderpoint": "0",
        "locationpreferredstocklevel": "1",
        "formulatext": "Yes",
        "formulanumeric": "1",
        "locationquantityonorder": "",
        "formulanumeric_1": "1",
        "formulatext_1": "Yes"
    }
}
Run Code Online (Sandbox Code Playgroud)

但是 thisNumber 的值返回为 0。我不明白为什么这不起作用?

netsuite suitescript2.0

2
推荐指数
1
解决办法
5730
查看次数

标签 统计

netsuite ×2

suitescript2.0 ×2

discord ×1

woocommerce ×1