Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Woocommerce 如果库存数量为空,则缺货_Woocommerce_Wpallimport - Fatal编程技术网

Woocommerce 如果库存数量为空,则缺货

Woocommerce 如果库存数量为空,则缺货,woocommerce,wpallimport,Woocommerce,Wpallimport,我正在使用WPAllimport来更新我的产品价格和库存状态。 我的经销商使用csv文件,其中库存数量仅在库存产品中填写数字,如果产品缺货,则数量字段为空。 如果数量不为0,则自动库存状态工具使所有物品都有库存。 导入已安排,插件每小时从URL下载一次文件。 如果csv文件中的库存数量为空,是否有办法使产品缺货?您可能可以调用一个自定义PHP函数来更新库存值,如本文档所述: 您可以从导入字段调用它,如下所示(取决于您的字段在CSV中的名称): function update_item_stoc

我正在使用WPAllimport来更新我的产品价格和库存状态。 我的经销商使用csv文件,其中库存数量仅在库存产品中填写数字,如果产品缺货,则数量字段为空。 如果数量不为0,则自动库存状态工具使所有物品都有库存。 导入已安排,插件每小时从URL下载一次文件。
如果csv文件中的库存数量为空,是否有办法使产品缺货?

您可能可以调用一个自定义PHP函数来更新库存值,如本文档所述:

您可以从导入字段调用它,如下所示(取决于您的字段在CSV中的名称):

function update_item_stock( $item_id, $stock_count ) {
    // if stock quantity is empty - adjust this according to value in the CSV:
    if( $stock_count == '' ) {
        wc_update_product_stock_status( $post_id, 'outofstock' ); 
     }
}
[update_item_stock( {product_id[1]}, {stock_qty[1]} )]