From 16d6d6f7e3b051b060fb24021f085a1c180ac8da Mon Sep 17 00:00:00 2001 From: Jordan Arldt Date: Fri, 16 Sep 2022 12:45:02 -0500 Subject: [PATCH] feat(storefront): STRF-9829 Migrate Cornerstone to new "Hide Price From Guests" functionality --- CHANGELOG.md | 1 + config.json | 1 - lang/en.json | 1 + schema.json | 6 -- schemaTranslations.json | 18 ------ templates/components/amp/products/card.html | 2 +- .../components/amp/products/product-view.html | 2 +- templates/components/cart/content.html | 6 +- templates/components/cart/preview.html | 4 +- templates/components/cart/totals.html | 4 +- templates/components/common/cart-preview.html | 2 +- templates/components/common/navigation.html | 2 +- .../components/products/add-to-cart.html | 2 +- templates/components/products/card.html | 6 +- templates/components/products/list-item.html | 4 +- .../components/products/product-info.html | 2 +- .../components/products/product-view.html | 4 +- templates/pages/cart.html | 58 ++++++++++--------- templates/pages/compare.html | 4 +- 19 files changed, 56 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b468e40c5..4545957ebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Draft +- Migrate Cornerstone to new "Hide Price From Guests" functionality [#2262](https://github.com/bigcommerce/cornerstone/pull/2262) ## 6.6.1 (09-14-2022) diff --git a/config.json b/config.json index dbd6681e5b..34b8155771 100644 --- a/config.json +++ b/config.json @@ -312,7 +312,6 @@ "color_hover_product_sold_out_badges": "#000000", "focusTooltip-textColor": "#ffffff", "focusTooltip-backgroundColor": "#313440", - "restrict_to_login": false, "swatch_option_size": "22x22", "social_icon_placement_top": false, "social_icon_placement_bottom": "bottom_none", diff --git a/lang/en.json b/lang/en.json index ab4fb741bb..43c5c4d630 100755 --- a/lang/en.json +++ b/lang/en.json @@ -39,6 +39,7 @@ "cart": { "nav_aria_label": "Cart with 0 items", "continue_shopping": "Click here to continue shopping", + "login_to_checkout": "Login to proceed to checkout", "items": "{NUM, plural, =0{(0 items)} one {(# item)} other {(# items)}}", "checkout": { "address": { diff --git a/schema.json b/schema.json index 1120470c02..225465c279 100644 --- a/schema.json +++ b/schema.json @@ -477,12 +477,6 @@ "type": "heading", "content": "i18n.PurchaseOptions" }, - { - "type": "checkbox", - "label": "i18n.HidePurchaseOptionsPriceAnd", - "force_reload": true, - "id": "restrict_to_login" - }, { "type": "heading", "content": "i18n.FormInputFields" diff --git a/schemaTranslations.json b/schemaTranslations.json index 957e6e0241..9f1b4788f6 100644 --- a/schemaTranslations.json +++ b/schemaTranslations.json @@ -1157,24 +1157,6 @@ "no": "Kjøpsalternativer", "ko": "구매 옵션" }, - "i18n.HidePurchaseOptionsPriceAnd": { - "default": "Hide purchase options (price and add to cart button) for customers who aren't logged in", - "fr": "Masquer les options dachat prix et bouton Ajouter au panier pour les clients qui ne sont pas connectés", - "it": "Nascondi le opzioni di acquisto prezzo e pulsante di aggiunta al carrello per i clienti che non hanno effettuato laccesso", - "uk": "Сховати параметри покупки (ціна та кнопка додавання у кошик) для клієнтів, які не ввійшли в систему", - "zh": "当客户未登录时,隐藏购买选项(价格和添加购物车按钮)在", - "de": "Kaufoptionen Preis und Schaltfläche „Zum Warenkorb hinzufügen“ für Kunden ausblenden die nicht angemeldet sind", - "es": "Ocultar opciones de compra precio y botón Añadir al carrito para clientes que no han iniciado sesión", - "nl": "Verberg aankoopopties knoppen Prijs en Toevoegen aan winkelmandje voor klanten die niet zijn ingelogd", - "pt": "Ocultar opções de compra botão de preço e de adicionar ao carrinho para clientes não conectados", - "sv": "Dölj köpalternativ pris och knappen Lägg i kundvagn för kunder som inte är inloggade", - "es-MX": "Ocultar opciones de compra (precio y botón Añadir al carrito) para clientes que no han iniciado sesión", - "pt-BR": "Ocultar opções de compra botão de preço e de adicionar ao carrinho para clientes não conectados", - "es-419": "Ocultar opciones de compra botón de precio y añadir al carrito para los clientes que no han iniciado sesión", - "da": "Skjul købsmuligheder pris og læg i kurv-knap for kunder der ikke er logget ind", - "no": "Skjul kjøpsalternativer pris og legg i handlekurv-knapp for kunder som ikke er pålogget", - "ko": "로그인하지 않은 고객을 위한 구매 옵션 숨기기가격 및 장바구니에 담기 버튼" - }, "i18n.FormInputFields": { "default": "Form Input fields", "fr": "Champs de saisie sur le formulaire", diff --git a/templates/components/amp/products/card.html b/templates/components/amp/products/card.html index b85c852dcf..5a797a84ce 100644 --- a/templates/components/amp/products/card.html +++ b/templates/components/amp/products/card.html @@ -27,7 +27,7 @@

- {{#or customer (if theme_settings.restrict_to_login '!==' true)}} + {{#or customer (unless settings.hide_price_from_guests)}} {{> components/products/price price=price customer=customer}} {{else}} {{> components/common/login-for-pricing}} diff --git a/templates/components/amp/products/product-view.html b/templates/components/amp/products/product-view.html index 2e42bcc5f8..363c0b27f7 100644 --- a/templates/components/amp/products/product-view.html +++ b/templates/components/amp/products/product-view.html @@ -27,7 +27,7 @@
- {{#or customer (if theme_settings.restrict_to_login '!==' true)}} + {{#or customer (unless settings.hide_price_from_guests)}} {{lang 'cart.checkout.price'}} - {{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}} + {{#or ../customer (unless ../settings.hide_price_from_guests) (if type '==' 'GiftCertificate')}} {{price.formatted}} {{#if price_discounted}} {{price_discounted.formatted}} @@ -140,13 +140,13 @@

{{lang 'cart.checkout.total'}} - {{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}} + {{#or ../customer (unless ../settings.hide_price_from_guests) (if type '==' 'GiftCertificate')}} {{total.formatted}} {{#if total_discounted}} {{total_discounted.formatted}} {{/if}} {{else}} - {{> components/common/login-for-pricing}} + -- {{/or}} {{#or can_modify (if type '==' 'GiftCertificate')}}

- {{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}} + {{#or ../customer (unless ../settings.hide_price_from_guests)}} {{quantity}} × {{price.formatted}} {{else}} {{> components/common/login-for-pricing}} diff --git a/templates/components/cart/totals.html b/templates/components/cart/totals.html index 263578dacf..4ed0d2fd18 100644 --- a/templates/components/cart/totals.html +++ b/templates/components/cart/totals.html @@ -4,7 +4,7 @@ {{lang 'cart.checkout.subtotal'}}:
- {{#or customer (if theme_settings.restrict_to_login '!==' true)}} + {{#or customer (unless settings.hide_price_from_guests)}} {{cart.sub_total.formatted}} {{else}} {{> components/common/login-for-pricing}} @@ -99,7 +99,7 @@ {{lang 'cart.checkout.grand_total'}}:
- {{#or customer (if theme_settings.restrict_to_login '!==' true)}} + {{#or customer (unless settings.hide_price_from_guests)}} {{cart.grand_total.formatted}} {{else}} {{> components/common/login-for-pricing}} diff --git a/templates/components/common/cart-preview.html b/templates/components/common/cart-preview.html index 303bd12380..8d7b324d25 100644 --- a/templates/components/common/cart-preview.html +++ b/templates/components/common/cart-preview.html @@ -33,7 +33,7 @@
{{#if quantity '>' 1}} {{quantity}} × {{/if}} - {{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}} + {{#or ../customer (unless ../settings.hide_price_from_guests) (if type '==' 'GiftCertificate')}} {{price.formatted}} {{#if price_discounted}} {{price_discounted.formatted}} diff --git a/templates/components/common/navigation.html b/templates/components/common/navigation.html index babc9c5826..2d73163494 100644 --- a/templates/components/common/navigation.html +++ b/templates/components/common/navigation.html @@ -1,5 +1,5 @@

- {{#or customer (if theme_settings.restrict_to_login '!==' true)}} + {{#or customer (unless settings.hide_price_from_guests)}}
{{/if}} - {{#or customer (if theme_settings.restrict_to_login '!==' true)}} + {{#or customer (unless settings.hide_price_from_guests)}} {{#if show_cart_action}} {{#if has_options}} {{lang 'products.choose_options'}} @@ -133,7 +133,7 @@

- {{#or customer (if theme_settings.restrict_to_login '!==' true)}} + {{#or customer (unless settings.hide_price_from_guests)}} {{> components/products/price price=price}} {{else}} {{> components/common/login-for-pricing}} diff --git a/templates/components/products/list-item.html b/templates/components/products/list-item.html index 7a62bdbc09..e08b71cd99 100644 --- a/templates/components/products/list-item.html +++ b/templates/components/products/list-item.html @@ -1,6 +1,6 @@ {{#if settings.data_tag_enabled}}
{{/if}}
- {{#or customer (if theme_settings.restrict_to_login '!==' true)}} + {{#or customer (unless settings.hide_price_from_guests)}} {{#if price}}
{{> components/products/price price=price}}
{{/if}} diff --git a/templates/components/products/product-info.html b/templates/components/products/product-info.html index 878e22c8b7..62a5b54290 100644 --- a/templates/components/products/product-info.html +++ b/templates/components/products/product-info.html @@ -1,4 +1,4 @@ -{{#or customer (unless theme_settings.restrict_to_login)}} +{{#or customer (unless settings.hide_price_from_guests)}} {{name}}, {{> components/products/product-aria-label}} {{else}} {{name}} diff --git a/templates/components/products/product-view.html b/templates/components/products/product-view.html index 76f87e068e..90b3dc890b 100644 --- a/templates/components/products/product-view.html +++ b/templates/components/products/product-view.html @@ -9,7 +9,7 @@ {{/each}}" data-product-brand="{{product.brand.name}}" data-product-price=" - {{#or customer (unless theme_settings.restrict_to_login)}} + {{#or customer (unless settings.hide_price_from_guests)}} {{#if product.price.with_tax}} {{product.price.with_tax.value}} {{else}} @@ -106,7 +106,7 @@

{{/if}}
- {{#or customer (if theme_settings.restrict_to_login '!==' true)}} + {{#or customer (unless settings.hide_price_from_guests)}} {{> components/products/price price=product.price}} {{else}} {{> components/common/login-for-pricing}} diff --git a/templates/pages/cart.html b/templates/pages/cart.html index ff815ed435..7178f7db14 100644 --- a/templates/pages/cart.html +++ b/templates/pages/cart.html @@ -28,37 +28,43 @@ {{{region name="cart_below_totals"}}} - {{#if cart.additional_checkout_buttons}} -
- {{/if}} + {{#or customer (unless settings.hide_price_from_guests)}} + {{#if cart.additional_checkout_buttons}} +
+ {{/if}} - {{#if cart.show_primary_checkout_button}} - + {{else}} + + {{/if}} + + {{#if cart.additional_checkout_buttons}} +
+ {{> components/cart/additional-checkout-buttons}} +
+ {{/if}} {{else}} - {{/if}} - - {{#if cart.additional_checkout_buttons}} -
- {{> components/cart/additional-checkout-buttons}} + {{lang 'cart.login_to_checkout'}}
- {{/if}} + {{/or}} {{else}}

{{lang 'cart.checkout.empty_cart'}}

diff --git a/templates/pages/compare.html b/templates/pages/compare.html index b6edecf213..adc8a096d6 100644 --- a/templates/pages/compare.html +++ b/templates/pages/compare.html @@ -37,7 +37,7 @@

{{lang 'compare.header' products=comparisons.length}} {{ name }}

- {{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}} + {{#or ../customer (unless ../settings.hide_price_from_guests)}} {{#if price_range}} {{> components/products/price-range}} {{else}} @@ -55,7 +55,7 @@

{{#each comparisons}} - {{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}} + {{#or ../customer (unless ../settings.hide_price_from_guests)}} {{#if show_cart_action}} {{#if has_options}} {{lang 'products.choose_options'}}