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
Fixed checkout layout
Damian Legawiec2108cf15f47d
diff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex ba1adefef1..32593f1d89 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -1077,21 +1077,6 @@ en:name: Namename_on_card: Name on cardname_or_sku: Name or SKU (enter at least first 3 characters of product name)- nav_bar:- admin_panel: Admin Panel- change_country: Change country- close_menu: Close menu- go_to_previous_menu: Go to previous menu- log_in: LOG IN- log_out: LOG OUT- my_account: My Account- my_orders: My Orders- show_menu: Show menu- show_search: Show search- show_user_menu: Show user menu- sign_up: SIGN UP- desktop: Desktop navigation- mobile: Mobile navigationnew: Newnew_adjustment: New Adjustmentnew_shipping_address: New Bhipping Addressdiff --git a/storefront/app/helpers/spree/storefront_helper.rb b/storefront/app/helpers/spree/storefront_helper.rbindex 9e7f8107a7..c0c1b26909 100644--- a/storefront/app/helpers/spree/storefront_helper.rb+++ b/storefront/app/helpers/spree/storefront_helper.rb@@ -1,6 +1,7 @@module Spreemodule StorefrontHelperinclude BaseHelper+ include Heroicon::Engine.helpersdef render_storefront_partials(section)Rails.application.config.spree_storefront.send(section).map do |partial|diff --git a/storefront/app/views/layouts/spree/checkout.html.erb b/storefront/app/views/layouts/spree/checkout.html.erbindex 738672a32d..ff67ccbfbb 100644--- a/storefront/app/views/layouts/spree/checkout.html.erb+++ b/storefront/app/views/layouts/spree/checkout.html.erb@@ -1,5 +1,4 @@<% content_for(:head) do %>- <%= render 'spree/shared/google_places_api_loader' %><meta name="robots" content="noindex, nofollow"><% end %>@@ -7,6 +6,7 @@<html lang="<%= I18n.locale %>"><head><%= render 'spree/shared/head' %>+ <%= render 'spree/shared/custom_head' %></head><body id="checkout-page" class="w-full bg-background text-text"><%= render_storefront_partials(:body_start_partials) %>diff --git a/storefront/app/views/spree/checkout/_coupon_code.html.erb b/storefront/app/views/spree/checkout/_coupon_code.html.erbindex 37d2f6a3d2..b22f9a0115 100644--- a/storefront/app/views/spree/checkout/_coupon_code.html.erb+++ b/storefront/app/views/spree/checkout/_coupon_code.html.erb@@ -1,5 +1,5 @@<%= turbo_frame_tag :checkout_coupon_code, class: "shopping-cart-coupon-code #{local_assigns[:classes]} flex flex-col gap-3" do %>- <% if promotion.nil? && [email protected]_card %>+ <% if promotion.nil? %><%= form_tag spree.checkout_apply_coupon_code_path(@order.token), method: :patch, data: {controller: "checkout-promotions"} do %><div class="flex" data-controller="enable-button"><%= hidden_field_tag :promotion_email, @order.email, data: {checkout_promotions_target: 'promotionEmailField'} %>@@ -26,7 +26,7 @@</div></div><% end %>- <% elsif @order.gift_card %>+ <% elsif @order.respond_to?(:gift_card) && @order.gift_card %><%= form_tag spree.checkout_remove_coupon_code_path(@order.token), method: :delete do %><%= hidden_field_tag :gift_card, @order.gift_card.code %><div class="m-0">diff --git a/storefront/app/views/spree/checkout/_payment.html.erb b/storefront/app/views/spree/checkout/_payment.html.erbindex 6d58ebf76a..8e3252afba 100644--- a/storefront/app/views/spree/checkout/_payment.html.erb+++ b/storefront/app/views/spree/checkout/_payment.html.erb@@ -1,9 +1,11 @@<%= form_for @order, url: spree.update_checkout_path(@order.token, @order.state), html: { id: "checkout_form_#{@order.state}" } do |form| %><%= form.hidden_field :state_lock_version %>- <%= turbo_frame_tag :gift_card_code_field do %>- <%= hidden_field_tag 'order[gift_card_code]', @order.gift_card&.code %>- <%= hidden_field_tag 'order[gift_card_amount]', @order.gift_card_total %>+ <% if @order.respond_to?(:gift_card) %>+ <%= turbo_frame_tag :gift_card_code_field do %>+ <%= hidden_field_tag 'order[gift_card_code]', @order.gift_card&.code %>+ <%= hidden_field_tag 'order[gift_card_amount]', @order.gift_card_total %>+ <% end %><% end %><% use_shipping = @order.shipping_eq_billing_address? || @order.bill_address.nil? || @order.bill_address.new_record? %>diff --git a/storefront/app/views/spree/checkout/_payment_methods.html.erb b/storefront/app/views/spree/checkout/_payment_methods.html.erbindex 5db9e27bce..9172970671 100644--- a/storefront/app/views/spree/checkout/_payment_methods.html.erb+++ b/storefront/app/views/spree/checkout/_payment_methods.html.erb@@ -2,7 +2,7 @@<% if [email protected]_required? && @order.using_store_credit? %><div class="d-flex flex-column mb-5"><p>- <% if @order.gift_card.present? %>+ <% if @order.respond_to?(:gift_card) && @order.gift_card.present? %><%= Spree.t(:gift_card_amount_applied, amount: @order.display_gift_card_total, code: @order.gift_card.code) %><% else %><%= Spree.t(:store_credits_amount_applied, amount: @order.display_total_applicable_store_credit.abs) %>diff --git a/storefront/app/views/spree/checkout/_summary.html.erb b/storefront/app/views/spree/checkout/_summary.html.erbindex 85cb551e7e..29369c6483 100644--- a/storefront/app/views/spree/checkout/_summary.html.erb+++ b/storefront/app/views/spree/checkout/_summary.html.erb@@ -83,7 +83,7 @@<% end %><% end %>- <% if order.gift_card.present? %>+ <% if order.respond_to?(:gift_card) && order.gift_card.present? %><div class="flex justify-between items-center mb-2"><span><%= Spree.t(:gift_card) %>:</span><span>-<%= order.display_gift_card_total %></span>diff --git a/storefront/app/views/spree/checkout/apply_coupon_code.turbo_stream.erb b/storefront/app/views/spree/checkout/apply_coupon_code.turbo_stream.erbindex f5dbd71e90..7a0770d4a6 100644--- a/storefront/app/views/spree/checkout/apply_coupon_code.turbo_stream.erb+++ b/storefront/app/views/spree/checkout/apply_coupon_code.turbo_stream.erb@@ -31,12 +31,14 @@result: @result, classes: @result.error.present? ? 'error' : '' %><% end %>-<%= turbo_stream.replace :gift_card_code_field do %>- <%= turbo_frame_tag :gift_card_code_field do %>- <%= hidden_field_tag 'order[gift_card_code]', @order.gift_card&.code %>- <%= hidden_field_tag 'order[gift_card_amount]', @order.gift_card_total %>- <% end %>-<% end %>+<% if @order.respond_to?(:gift_card) %>+ <%= turbo_stream.replace :gift_card_code_field do %>+ <%= turbo_frame_tag :gift_card_code_field do %>+ <%= hidden_field_tag 'order[gift_card_code]', @order.gift_card&.code %>+ <%= hidden_field_tag 'order[gift_card_amount]', @order.gift_card_total %>+ <% end %>+ <% end %>+<% end%><%= turbo_stream.replace :checkout_store_credit do %><%= render 'store_credit' %>diff --git a/storefront/app/views/spree/checkout/payment/_store_credit.html.erb b/storefront/app/views/spree/checkout/payment/_store_credit.html.erbindex 1fc95d50e4..f2073f8e64 100644--- a/storefront/app/views/spree/checkout/payment/_store_credit.html.erb+++ b/storefront/app/views/spree/checkout/payment/_store_credit.html.erb@@ -1,7 +1,7 @@<% if @order.using_store_credit? %><div class="d-flex flex-column mb-5" data-hook="checkout_payment_store_credit_success"><p class="store-credit-title font-body">- <% if @order.gift_card.present? %>+ <% if @order.respond_to?(:gift_card) && @order.gift_card.present? %><%= Spree.t(:gift_card_amount_applied, amount: @order.display_gift_card_total, code: @order.gift_card.code) %><% else %><%= Spree.t(:store_credits_amount_applied, amount: @order.display_total_applicable_store_credit.abs) %>diff --git a/storefront/app/views/spree/checkout/remove_coupon_code.turbo_stream.erb b/storefront/app/views/spree/checkout/remove_coupon_code.turbo_stream.erbindex 743db5fa1b..0b084c9c8a 100644--- a/storefront/app/views/spree/checkout/remove_coupon_code.turbo_stream.erb+++ b/storefront/app/views/spree/checkout/remove_coupon_code.turbo_stream.erb@@ -19,12 +19,15 @@<%= render 'coupon_code', promotion: @order.valid_coupon_promotions.first,result: @result, classes: @result.error.present? ? 'error' : '' %><% end %>-<%= turbo_stream.replace :gift_card_code_field do %>- <%= turbo_frame_tag :gift_card_code_field do %>- <%= hidden_field_tag 'order[gift_card_code]', @order.gift_card&.code %>- <%= hidden_field_tag 'order[gift_card_amount]', @order.gift_card_total %>++<% if @order.respond_to?(:gift_card) %>+ <%= turbo_stream.replace :gift_card_code_field do %>+ <%= turbo_frame_tag :gift_card_code_field do %>+ <%= hidden_field_tag 'order[gift_card_code]', @order.gift_card&.code %>+ <%= hidden_field_tag 'order[gift_card_amount]', @order.gift_card_total %>+ <% end %><% end %>-<% end %>+<% end%><%= turbo_stream.replace :checkout_store_credit do %><%= render 'store_credit' %>diff --git a/storefront/app/views/themes/default/spree/shared/_error_messages_without_base_attribute.html.erb b/storefront/app/views/themes/default/spree/shared/_error_messages_without_base_attribute.html.erbnew file mode 100644index 0000000000..4d62baaaa5--- /dev/null+++ b/storefront/app/views/themes/default/spree/shared/_error_messages_without_base_attribute.html.erb@@ -0,0 +1,15 @@+<% if target && target.errors.any? %>+ <div id="errorExplanation" class="alert-error text-center mb-4 p-2">+ <ul>+ <% target.errors.messages.each do |msg| %>+ <li>+ <% if msg[0] != :base && !msg[0].to_s.ends_with?(".base") %>+ <%= target.errors.full_messages_for(msg[0]).to_sentence %>+ <% else %>+ <%= msg[1].flatten.to_sentence %>+ <% end %>+ </li>+ <% end %>+ </ul>+ </div>+<% end %>