-1
在WooCommerce中添加一些產品變體時,默認情況下會設置3個變體,並且無法添加新變體。WooCommerce:默認添加3個變體
這是我的代碼:
$my_post = array(
'post_title' => 'Variation #' . $i . ' of 4 for prdct#'. $new_post_id,
'post_name' => 'product-' . $new_post_id . '-variation-' . $i,
'post_status' => 'publish',
'post_parent' => $new_post_id,
'post_type' => 'product_variation',
'guid' => home_url() . '/?product_variation=product-' . $new_post_id . '-variation-' . $i
);
$attID = wp_insert_post($my_post);
任何解決方案?
你的問題不清楚,你的代碼不完整。你在哪裏使用它?什麼工作?什麼不是?哪裏定義了'$ new_post_id'?你是否使用了一些鉤子代碼?請編輯你的問題,並添加必要的細節以獲得幫助......如果你想讓這個問題得到人們的關注,你必須清楚而詳細。 – LoicTheAztec