Skip to content

Commit

Permalink
Using find_or_build_default_price when getting variants price in its …
Browse files Browse the repository at this point in the history
…edit form
  • Loading branch information
softr8 committed Feb 4, 2019
1 parent c05ad7b commit dc40bc9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/variants/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<div class="col-3">
<div class="field" data-hook="price">
<%= f.label :price %>
<%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :price, currency: @variant.default_price.currency %>
<%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :price, currency: @variant.find_or_build_default_price.currency %>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion core/spec/models/spree/variant/pricing_options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
subject { described_class.from_context(view_context) }

context "if the store has not defined default_currency" do
let(:store) { FactoryBot.create :store, default_currency: nil , cart_tax_country_iso: nil }
let(:store) { FactoryBot.create :store, default_currency: nil, cart_tax_country_iso: nil }

it "fallbacks to Spree::Config.currency" do
expect(Spree::Variant::PricingOptions).to receive(:new).with(currency: Spree::Config.currency, country_iso: nil)
Expand Down

0 comments on commit dc40bc9

Please sign in to comment.