diff --git a/app/services/line_item_syncer.rb b/app/services/line_item_syncer.rb index 4d9d925900..5cff5a5688 100644 --- a/app/services/line_item_syncer.rb +++ b/app/services/line_item_syncer.rb @@ -76,9 +76,9 @@ class LineItemSyncer def stock_issue_description(line_item) if line_item.variant.in_stock? - I18n.t("spree.orders.line_item.insufficient_stock", on_hand: line_item.variant.on_hand) + I18n.t("admin.subscriptions.stock.insufficient_stock") else - I18n.t("spree.orders.line_item.out_of_stock") + I18n.t("admin.subscriptions.stock..out_of_stock") end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 015624df34..48d74e6012 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1076,6 +1076,9 @@ en: saving: "SAVING" saved: "SAVED" product_already_in_order: This product has already been added to the order. Please edit the quantity directly. + stock: + insufficient_stock: "Insufficient stock available" + out_of_stock: "Out of Stock" orders: number: Number confirm_edit: Are you sure you want to edit this order? Doing so may make it more difficult to automatically sync changes to the subscription in the future. diff --git a/spec/services/order_syncer_spec.rb b/spec/services/order_syncer_spec.rb index 94308f7540..86cad86a44 100644 --- a/spec/services/order_syncer_spec.rb +++ b/spec/services/order_syncer_spec.rb @@ -416,8 +416,7 @@ describe OrderSyncer do expect(line_items.map(&:quantity)).to eq [1] expect(order.reload.total.to_f).to eq 59.97 line_item = order.line_items.find_by_variant_id(sli.variant_id) - # when we complete the order in this test case, the one item in the original order is taken from stock, this moved the available stock to 1 - expect(syncer.order_update_issues[order.id]).to include "#{line_item.product.name} - #{line_item.variant.full_name} - Insufficient stock available, only 1 remaining" + expect(syncer.order_update_issues[order.id]).to include "#{line_item.product.name} - #{line_item.variant.full_name} - Insufficient stock available" end end end @@ -502,7 +501,7 @@ describe OrderSyncer do line_items = Spree::LineItem.where(order_id: subscription.orders, variant_id: variant.id) expect(line_items.map(&:quantity)).to eq [0] expect(order.reload.total.to_f).to eq 59.97 - expect(syncer.order_update_issues[order.id]).to include "#{variant.product.name} - #{variant.full_name} - Insufficient stock available, only 5 remaining" + expect(syncer.order_update_issues[order.id]).to include "#{variant.product.name} - #{variant.full_name} - Insufficient stock available" end end end