mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Set default shipping_category if absent
This commit is contained in:
@@ -78,6 +78,7 @@ module Spree
|
||||
}
|
||||
|
||||
before_validation :set_cost_currency
|
||||
before_validation :ensure_shipping_category
|
||||
before_validation :ensure_unit_value
|
||||
before_validation :update_weight_from_unit_value, if: ->(v) { v.product.present? }
|
||||
|
||||
@@ -249,6 +250,10 @@ module Spree
|
||||
self.unit_value = 1.0
|
||||
end
|
||||
|
||||
def ensure_shipping_category
|
||||
self.shipping_category ||= DefaultShippingCategory.find_or_create
|
||||
end
|
||||
|
||||
def convert_variant_weight_to_decimal
|
||||
self.weight = weight.to_d
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user