diff --git a/app/models/order_decorator.rb b/app/models/order_decorator.rb index 2386868..5c7edab 100644 --- a/app/models/order_decorator.rb +++ b/app/models/order_decorator.rb @@ -6,6 +6,12 @@ Order.class_eval do true end + # Is at least one product/variant digital? + def some_digital? + line_items.map { |item| return true if item.digital? } + false + end + # Determine which method to use for shipping of digital products. def digital_shipping_method rates = rate_hash diff --git a/app/views/order_mailer/confirm_email.text.erb b/app/views/order_mailer/confirm_email.text.erb index 018c34a..5fda710 100644 --- a/app/views/order_mailer/confirm_email.text.erb +++ b/app/views/order_mailer/confirm_email.text.erb @@ -15,6 +15,7 @@ Subtotal: <%= number_to_currency @order.item_total %> <% end %> Order Total: <%= number_to_currency @order.total %> +<% if @order.some_digital? %> ============================================================ Download links for digital products ============================================================ @@ -33,5 +34,5 @@ ATTENTION! Each link will only work a SINGLE TIME! <% end %> <% end %> ============================================================ - +<% end %> Thank you for your business.