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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
[SD-1404] - Always link to Product pages in Emails (#11219)
Matthew Kennedy3d7bf4cd8fdf
diff --git a/core/app/helpers/spree/base_helper.rb b/core/app/helpers/spree/base_helper.rbindex c7d79df4b0..0c2cda17a6 100644--- a/core/app/helpers/spree/base_helper.rb+++ b/core/app/helpers/spree/base_helper.rb@@ -176,7 +176,7 @@ module Spreeenddef spree_storefront_resource_url(resource, options = {})- if locale_param+ if defined?(locale_param) && locale_param.present?options.merge!(locale: locale_param)enddiff --git a/emails/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb b/emails/app/views/spree/reimbursement_mailer/reimbursement_email.html.erbindex d80774903f..5573738e0a 100644--- a/emails/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb+++ b/emails/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb@@ -19,20 +19,12 @@<% @reimbursement.return_items.exchange_requested.each do |return_item| %><tr><td class="purchase_image">- <% if frontend_available? %>- <%= link_to(image_tag(variant_image_url(return_item.variant)), spree.product_url(return_item.variant.product)) %>- <% else %>- <%= image_tag(variant_image_url(return_item.variant)) %>- <% end %>+ <%= link_to(image_tag(variant_image_url(return_item.variant)), spree_storefront_resource_url(return_item.variant.product)) %></td><td class="purchase_item"><strong><span class="f-fallback">- <% if frontend_available? %>- <%= link_to raw(return_item.variant.name), spree.product_url(return_item.variant.product) %>- <% else %>- <%= raw(return_item.variant.name) %>- <% end %>+ <%= link_to raw(return_item.variant.name), spree_storefront_resource_url(return_item.variant.product) %></span></strong><p class="purchase_item--additional">diff --git a/emails/app/views/spree/shared/_mailer_line_item.html.erb b/emails/app/views/spree/shared/_mailer_line_item.html.erbindex 020d4ccbca..74795247d6 100644--- a/emails/app/views/spree/shared/_mailer_line_item.html.erb+++ b/emails/app/views/spree/shared/_mailer_line_item.html.erb@@ -1,11 +1,7 @@<tr><td class="six sub-columns"><strong>- <% if frontend_available? %>- <%= link_to raw(line_item.variant.product.name), spree.product_url(line_item.variant.product) %>- <% else %>- <%= raw(line_item.variant.product.name) %>- <% end %>+ <%= link_to raw(line_item.variant.product.name), spree_storefront_resource_url(line_item.variant.product) %></strong><%= raw(line_item.variant.options_text) -%>(<%= line_item.variant.sku %>)diff --git a/emails/app/views/spree/shared/purchased_items_table/_line_item.html.erb b/emails/app/views/spree/shared/purchased_items_table/_line_item.html.erbindex 34c92cb88f..1203317e10 100644--- a/emails/app/views/spree/shared/purchased_items_table/_line_item.html.erb+++ b/emails/app/views/spree/shared/purchased_items_table/_line_item.html.erb@@ -1,19 +1,11 @@<tr><td class="purchase_image">- <% if frontend_available? %>- <%= link_to(image_tag(variant_image_url(line_item.variant)), spree.product_url(line_item.product)) %>- <% else %>- <%= image_tag(variant_image_url(line_item.variant)) %>- <% end %>+ <%= link_to(image_tag(variant_image_url(line_item.variant)), spree_storefront_resource_url(line_item.product)) %></td><td class="purchase_item"><strong><span class="f-fallback">- <% if frontend_available? %>- <%= link_to raw(line_item.name), spree.product_url(line_item.product) %>- <% else %>- <%= raw(line_item.name) %>- <% end %>+ <%= link_to raw(line_item.name), spree_storefront_resource_url(line_item.product) %></span></strong><p class="purchase_item--additional"><%= raw(line_item.variant.options_text) -%></p>diff --git a/emails/spec/mailers/spree/shipment_mailer_spec.rb b/emails/spec/mailers/spree/shipment_mailer_spec.rbindex 1837218773..d2ae1cc0c6 100644--- a/emails/spec/mailers/spree/shipment_mailer_spec.rb+++ b/emails/spec/mailers/spree/shipment_mailer_spec.rb@@ -11,7 +11,9 @@ describe Spree::ShipmentMailer, type: :mailer dolet(:shipment) { order.shipments.first }let(:shipping_method) { shipment.shipping_method }- before { shipping_method.update(tracking_url: 'http://example.com/tracking') }+ before do+ shipping_method.update(tracking_url: 'http://example.com/tracking')+ endcontext ':from not set explicitly' doit 'falls back to spree config' do