Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove respect_shopify_publish_status_and_dates config #230

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions config/shopify.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,4 @@
* Where should the Shopify API client store its session data
*/
'session_storage_path' => env('SHOPIFY_SESSION_STORAGE_PATH', '/tmp/php_sessions'),

/**
* Should publish status and date be determined by Shopify's settings
* (this config is for backwards compatibility; this will not be configurable in the next major version)
*/
'respect_shopify_publish_status_and_dates' => true,
];
35 changes: 16 additions & 19 deletions src/Jobs/ImportSingleProductJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,26 +199,23 @@ public function handle()

// publication state
try {
// @deprecated: config will be removed in next major version
if (config('shopify.respect_shopify_publish_status_and_dates', false)) {
$publicationStatus = collect(Arr::get($response->getDecodedBody(), 'data.product.resourcePublications.edges', []))
->where('node.publication.name', 'Online Store')
->map(function ($channel) {
if (! $node = $channel['node'] ?? []) {
return [];
}

return $node;
})
->filter()
->first();

if ($publicationStatus) {
$entry->published($publicationStatus['isPublished'] ?? false);

if ($entry->collection()->dated() && $publicationStatus['publishDate']) {
$entry->date(Carbon::parse($publicationStatus['publishDate']));
$publicationStatus = collect(Arr::get($response->getDecodedBody(), 'data.product.resourcePublications.edges', []))
->where('node.publication.name', 'Online Store')
->map(function ($channel) {
if (! $node = $channel['node'] ?? []) {
return [];
}

return $node;
})
->filter()
->first();

if ($publicationStatus) {
$entry->published($publicationStatus['isPublished'] ?? false);

if ($entry->collection()->dated() && $publicationStatus['publishDate']) {
$entry->date(Carbon::parse($publicationStatus['publishDate']));
}
}
} catch (\Throwable $e) {
Expand Down
Loading