제품 배송 확장 (https://docs.woocommerce.com/document/per-product-shipping/) 당 WooCommerce와 WooCommerce가 있습니다. 현재 문제가 있습니다. 즉, 우연 제품을 복제 할 때마다 제품 별 배송 정보가 복사되지 않습니다. 나는 사람이 어떤이는위한 추가적인의 예입니다 다음중복 제품 별 배송 정보 - WooCommerce
add_action('woocommerce_product_duplicate', 'wdm_duplicate_pps_entries',10,2);
function wdm_duplicate_pps_entries($new_id, $post) {
global $wpdb;
$id = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : '';
if(!empty($id)) {
$query = "Select * From " . $wpdb->prefix . "woocommerce_per_product_shipping_rule
Where product_id = '" . $id . "'";
$result = $wpdb->get_results($query);
$table_name = $wpdb->prefix . "woocommerce_per_product_shipping_rule";
foreach($result as $single_result) {
$data = array('product_id' => $new_id, 'rule_country' => $single_result->rule_country, 'rule_state' => $single_result->rule_state,'rule_postcode' => $single_result->rule_postcode,'rule_cost' => $single_result->rule_cost,'rule_item_cost' => $single_result->rule_item_cost,'rule_order' => $single_result->rule_order);
$wpdb->insert($table_name,$data);
}
}
}
에서 잘못된 것입니다 볼 수 있습니다, 이것에 대한 해결책을 찾기 위해 노력하고 내가이 일을 얻을 수 없었다 그러나 다음과 같은 코드를 가지고있다 정보 복사하려고합니다. -
방법 코드에서 다른이 코드는 질문에 게시 된이 버그를 수정했다? –