Fixed product status issue
This commit is contained in:
@@ -94,11 +94,17 @@ class Wiaas_Admin_Product {
|
||||
|
||||
public static function wiaas_my_save_post($post_id) {
|
||||
|
||||
global $post;
|
||||
$status = get_post_status( $post->ID);
|
||||
|
||||
$value = get_field('_wiaas_product_country', $post_id, true);
|
||||
$type = get_field('_wiaas_product_type', $post_id, true);
|
||||
|
||||
error_log($status);
|
||||
error_log($value);
|
||||
|
||||
if (!empty($value)) {
|
||||
|
||||
if (!empty($value) && $status === '_wiaas_no_country' ) {
|
||||
|
||||
wp_set_object_terms($post_id, $value, 'product_country', true);
|
||||
wp_set_object_terms($post_id, $type, 'product_type', true);
|
||||
@@ -108,14 +114,7 @@ class Wiaas_Admin_Product {
|
||||
'post_status' => 'draft'
|
||||
));
|
||||
|
||||
} else {
|
||||
|
||||
wp_update_post(array(
|
||||
'ID' => $post_id,
|
||||
'post_status' => '_wiaas_no_country'
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user