Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fixed 5.4 migration tasks

Damian Legawiec4e269c7aac74
diff --git a/docs/api-reference/webhooks-events.mdx b/docs/api-reference/webhooks-events.mdx
index f5bca8381e..ec188d07f8 100644
--- a/docs/api-reference/webhooks-events.mdx
+++ b/docs/api-reference/webhooks-events.mdx
@@ -350,7 +350,7 @@ Variant event payloads include pricing, stock status, and always-included `optio
"is_master": false,
"options_text": "Size: M, Color: Black",
"track_inventory": true,
- "image_count": 2,
+ "media_count": 2,
"thumbnail": "https://cdn.example.com/images/tote-bag-black.jpg",
"purchasable": true,
"in_stock": true,
diff --git a/spree/core/lib/tasks/markets.rake b/spree/core/lib/tasks/markets.rake
index cca3678b01..2300662137 100644
--- a/spree/core/lib/tasks/markets.rake
+++ b/spree/core/lib/tasks/markets.rake
@@ -27,10 +27,13 @@ namespace :spree do
name: primary_country&.name || 'Default',
currency: iso_country&.currency_code || store.read_attribute(:default_currency) || 'USD',
default_locale: iso_country&.languages_official&.first || store.read_attribute(:default_locale) || 'en',
- default: true,
- countries: countries
+ default: true
)
+ countries.each do |country|
+ market.market_countries.build(country: country).save!(validate: false)
+ end
+
store.update_column(:checkout_zone_id, nil) if checkout_zone_id
puts " Created market '#{market.name}' with #{countries.size} countries for store '#{store.name}' (#{store.code})"
diff --git a/spree/core/lib/tasks/variants.rake b/spree/core/lib/tasks/variants.rake
index ad3b43569d..88bbe3d0a8 100644
--- a/spree/core/lib/tasks/variants.rake
+++ b/spree/core/lib/tasks/variants.rake
@@ -1,12 +1,12 @@
namespace :spree do
namespace :variants do
- desc 'Reset image_count counter cache on variants'
+ desc 'Reset media_count counter cache on variants'
task reset_counter_caches: :environment do |_t, _args|
puts 'Resetting variant counter caches...'
Spree::Variant.find_each do |variant|
variant.update_columns(
- image_count: variant.images.count,
+ media_count: variant.images.count,
updated_at: Time.current
)
print '.'