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.

Return nil (null) for :price & :total_price if not available in current_currency else return integer.

Matthew Kennedy55bc9da90661
diff --git a/core/app/models/spree/wished_product.rb b/core/app/models/spree/wished_product.rb
index ff331d028a..f3b23fc6ef 100644
--- a/core/app/models/spree/wished_product.rb
+++ b/core/app/models/spree/wished_product.rb
@@ -11,11 +11,23 @@ module Spree
validates :variant, :wishlist, presence: true
def price(currency)
- variant.price_in(currency[:currency]).amount.to_i
+ variant_price = variant.price_in(currency[:currency]).amount
+
+ if variant_price.nil?
+ variant_price
+ else
+ variant_price.to_i
+ end
end
def total(currency)
- quantity * variant.price_in(currency[:currency]).amount.to_i
+ variant_price = variant.price_in(currency[:currency]).amount
+
+ if variant_price.nil?
+ variant_price
+ else
+ quantity * variant_price.to_i
+ end
end
end
end