Fixed product status issue

This commit is contained in:
Nedim Uka
2018-10-18 17:28:31 +02:00
parent 071c549726
commit 00e853ae6b

View File

@@ -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'
));
}
}
}