dongxian8858 2017-07-10 15:20
浏览 45

WooCommerce - 从外部应用程序结账后的新订单元

The issue seems complex to me and I have only some ideas, but I am not experienced enough to develop them on my own. I would love some guidance on this.

So, I want to insert additional order metadata into an existing order. Let's say the process looks like that:

Checkout with all the needed info -> External app opens -> User inputs data and clicks save -> External app adds the input to the database for the current order

I have already studied wp_postmeta table. I have general idea on how to get data from input forms into the database. Small example from HTML form:

<input type="text" name="cprawy" id="cprawy" value="-1" maxlength="5">
<input type="text" name="clewy" id="clewy" value="1" maxlength="5">

Then there is process.php file, in which the data is inserted. Of course I have connected the database, skipped that part of the code. And here it all goes into uncharted territory for me.

$clewy = $_POST ['clewy'];
$cprawy = $_POST ['cprawy'];
$query  = "INSERT INTO wp_postmeta (meta_key, meta_value) 
        VALUES ('".$_POST["billing_clewy"]."','".$_POST["billing_cprawy"]."')";

I am almost certain that the above code is wrong on some levels.

Also, I somehow need to fetch the order ID and connect above items with it, so it displays correctly on the order fields in WooCommerce.

Is there anyone here that could help me with this?

Thanks in advance, Tomasz

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制
    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办