Skip to content

Commit

Permalink
Fix how we set publish status on products (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell authored Nov 29, 2024
1 parent 3865d64 commit d2f6535
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Jobs/ImportSingleProductJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ public function handle()
}
}

$published = $this->data['status'] === 'active' ? true : false;

$data = [
'product_id' => $this->data['id'],
'published' => $this->data['status'] === 'active' ? true : false,
'published_at' => $this->data['status'] === 'active' ? Carbon::parse($this->data['published_at'])->format('Y-m-d H:i:s') : null,
'title' => (! $entry || config('shopify.overwrite.title')) ? $this->data['title'] : $entry->title,
'content' => (! $entry || config('shopify.overwrite.content')) ? $this->data['body_html'] : $entry->content,
Expand Down Expand Up @@ -225,8 +226,6 @@ public function handle()
$published = true;
}
}

$entry->published($published);
}
} catch (\Throwable $e) {
Log::error('Could not manage publications status for product '.$this->data['id']);
Expand All @@ -237,6 +236,7 @@ public function handle()
Log::error($e->getMessage());
}

$entry->published($published);
$entry->save();

// if we are multisite, get translations
Expand Down

0 comments on commit d2f6535

Please sign in to comment.