app/serializers/spree/v2/storefront/variant_serializer.rb in spree_api-4.2.0.rc2 vs app/serializers/spree/v2/storefront/variant_serializer.rb in spree_api-4.2.0.rc3
- old
+ new
@@ -5,12 +5,20 @@
set_type :variant
attributes :sku, :price, :currency, :display_price, :weight, :height,
:width, :depth, :is_master, :options_text
- attribute :purchasable, &:purchasable?
- attribute :in_stock, &:in_stock?
- attribute :backorderable, &:backorderable?
+ attribute :purchasable do |variant|
+ variant.purchasable?
+ end
+
+ attribute :in_stock do |variant|
+ variant.in_stock?
+ end
+
+ attribute :backorderable do |variant|
+ variant.backorderable?
+ end
belongs_to :product
has_many :images
has_many :option_values
end