diff --git a/app/views/spree/shipment_mailer/shipped_email.html.haml b/app/views/spree/shipment_mailer/shipped_email.html.haml
index da606c35a0..7892ceb89b 100644
--- a/app/views/spree/shipment_mailer/shipped_email.html.haml
+++ b/app/views/spree/shipment_mailer/shipped_email.html.haml
@@ -1,12 +1,17 @@
-%h3
- = t('.dear_customer')
+- if @shipment.order.distributor.logo.variable?
+ - @enterprise_for_logo = @shipment.order.distributor
+
+- greeting_key = "mailers_shared.customer_greeting"
- if @delivery
- %p.lead
- = t('.instructions', distributor: @shipment.order.distributor.name)
+ - intro_key = ".shipped_intro_html"
- else
- %p.lead
- = t('.picked_up_instructions', distributor: @shipment.order.distributor.name)
+ - intro_key = ".picked_up_intro_html"
+
+= render partial: 'shared/mailers/greeting_and_intro',
+ locals: { greeting: t(greeting_key, name: @shipment.order.bill_address.firstname),
+ intro: t(intro_key, distributor: @shipment.order.distributor.name),
+ enterprise_for_logo: @enterprise_for_logo }
%p
%strong
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a9b7afe643..261a0453ac 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -368,6 +368,7 @@ en:
# E-Mails
#
mailers_shared:
+ customer_greeting: "Dear %{name},"
general_greeting: "Hello!"
enterprise_mailer:
confirmation_instructions:
@@ -397,8 +398,6 @@ en:
link_label: "%{name}"
shipment_mailer:
shipped_email:
- dear_customer: "Dear Customer,"
- instructions: "Your order has been shipped"
shipment_summary: "Shipment Summary"
subject: "Shipment Notification"
thanks: "Thank you for your business."
@@ -3926,6 +3925,10 @@ See the %{link} to find out more about %{sitename}'s features and to start using
error: Webhook endpoint failed to delete
spree:
+ shipment_mailer:
+ shipped_email:
+ shipped_intro_html: "Your order from %{distributor} has been shipped."
+ picked_up_intro_html: "Your order from %{distributor} has been picked-up."
test_mailer:
test_email:
greeting: "Congratulations!"
@@ -4721,14 +4724,11 @@ See the %{link} to find out more about %{sitename}'s features and to start using
message: "A payment for order %{order_number} requires additional authorization from the customer. The customer has been notified via email and the payment will appear as pending until it is authorized."
shipment_mailer:
shipped_email:
- dear_customer: "Dear Customer,"
- instructions: "Your order from %{distributor} has been shipped"
shipment_summary: "Shipment Summary"
subject: "Shipment Notification"
thanks: "Thank you for your business."
track_information: ! "Tracking Information: %{tracking}"
track_link: ! "Tracking Link: %{url}"
- picked_up_instructions: "Your order from %{distributor} has been picked-up"
picked_up_subject: "Pick up Notification"
test_mailer:
test_email:
diff --git a/spec/mailers/shipment_mailer_spec.rb b/spec/mailers/shipment_mailer_spec.rb
index e81ea4d0cb..4544b14ad0 100644
--- a/spec/mailers/shipment_mailer_spec.rb
+++ b/spec/mailers/shipment_mailer_spec.rb
@@ -42,13 +42,12 @@ RSpec.describe Spree::ShipmentMailer do
it "includes the distributor's name in the body" do
shipment_email = Spree::ShipmentMailer.shipped_email(shipment, delivery: true)
- expect(shipment_email.body).to include("Your order from #{distributor.name} has been shipped")
+ expect(shipment_email.body).to include("Your order from #{distributor.name} has been shipped")
end
it "picked_up email includes different text in body" do
- text = "Your order from #{distributor.name} has been picked-up"
picked_up_email = Spree::ShipmentMailer.shipped_email(shipment, delivery: false)
- expect(picked_up_email.body).to include(text)
+ expect(picked_up_email.body).to include("Your order from #{distributor.name} has been picked-up")
end
it "picked_up email has different subject" do