Skip to content
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
2 changes: 1 addition & 1 deletion docs/content/en/CMS/multisite.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Ensure your API key has enabled the `read_translations` permission for this feat

You need to enable multi-site on the `Products` collection and `Collections`, `Product Types`, `Tags` and `Vendor` taxonomies. You can do this by editing the configuration and adding the sites you want to enable to the `sites` field.

On the Products collection ensure that `Propogate` is toggled on, and that the `Origin Behaviour` is set to `Use the site the entry was created in`.
On the Products collection ensure that `Propagate` is toggled on, and that the `Origin Behaviour` is set to `Use the site the entry was created in`.

## How it works

Expand Down
4 changes: 2 additions & 2 deletions src/Jobs/ImportSingleProductJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public function handle()

$translations = Arr::get($response->getDecodedBody(), 'data.translatableResource.translations', []);

if ($translations) {
if ($translations || $entry->collection()->propagate()) {
$localizedEntry = $entry->in($site->handle());

if (! $localizedEntry) {
Expand Down Expand Up @@ -504,7 +504,7 @@ private function importVariants(array $returnedVariants, string $product_slug)

$translations = Arr::get($response->getDecodedBody(), 'data.translatableResource.translations', []);

if ($translations) {
if ($translations || $entry->collection()->propagate()) {
$localizedEntry = $entry->in($site->handle());

if (! $localizedEntry) {
Expand Down
17 changes: 5 additions & 12 deletions src/Tags/Shopify.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,18 +249,11 @@ protected function fetchProductVariants($productSlug)
return null;
}

return $entries->map(function ($variant) {
$values = [];
$values['id'] = $variant->id();
$values['slug'] = $variant->slug();

// Map all variant values to data to ensure we are getting everything.
foreach ($variant->data() as $key => $value) {
$values[$key] = $value;
}

return $values;
});
return $entries->map(fn ($variant) => [
'id' => $variant->id(),
'slug' => $variant->slug(),
...$variant->values(),
])->unique('variant_id')->values();
}

/**
Expand Down