我设法让它工作,下面是答案:
-在将更新新货导入自定义字段时:\\u custom\\u stock\\u placeholder
-仅更新此字段:\\u custom\\u stock\\u placeholder
-将此代码添加到函数中。php
add_action(\'pmxi_saved_post\', \'post_saved\', 10, 1);
function post_saved($id) {
$original_stock = get_post_meta($id, \'_stock\', true);
$new_stock = get_post_meta($id, \'_custom_stock_placeholder\', true);
$combined_stock= $original_stock + $new_stock;
update_post_meta($id, \'_stock\', $combined_stock);
}