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.

Added weight/dimensions unit to Variants (#12036)

Damian Legawiec395be8febfb1
diff --git a/api/spec/serializers/spree/api/v2/platform/variant_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/variant_serializer_spec.rb
index d8edba0ecb..7966fb171b 100644
--- a/api/spec/serializers/spree/api/v2/platform/variant_serializer_spec.rb
+++ b/api/spec/serializers/spree/api/v2/platform/variant_serializer_spec.rb
@@ -20,8 +20,10 @@ describe Spree::Api::V2::Platform::VariantSerializer do
sku: variant.sku,
barcode: variant.barcode,
weight: variant.weight,
+ weight_unit: variant.weight_unit,
height: variant.height,
depth: variant.depth,
+ dimensions_unit: variant.dimensions_unit,
deleted_at: variant.deleted_at,
is_master: variant.is_master,
cost_price: variant.cost_price,
diff --git a/core/db/migrate/20240514105216_add_weight_and_dimension_units_to_spree_variants.rb b/core/db/migrate/20240514105216_add_weight_and_dimension_units_to_spree_variants.rb
new file mode 100644
index 0000000000..2a16841248
--- /dev/null
+++ b/core/db/migrate/20240514105216_add_weight_and_dimension_units_to_spree_variants.rb
@@ -0,0 +1,6 @@
+class AddWeightAndDimensionUnitsToSpreeVariants < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_variants, :weight_unit, :string, if_not_exists: true
+ add_column :spree_variants, :dimensions_unit, :string, if_not_exists: true
+ end
+end