Skip to content

Commit

Permalink
feat(storefront): STRF-9829 Migrate Cornerstone to new "Hide Price Fr…
Browse files Browse the repository at this point in the history
…om Guests" functionality
  • Loading branch information
jordanarldt committed Sep 13, 2022
1 parent 785bd4a commit 87c9966
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 55 deletions.
1 change: 0 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
6 changes: 0 additions & 6 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion templates/components/amp/products/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h3 class="card-title">
</h3>

<div class="card-text" data-test-info-type="price">
{{#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}}
Expand Down
2 changes: 1 addition & 1 deletion templates/components/amp/products/product-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</amp-carousel>
</section>
<div class="productView-action">
{{#or customer (if theme_settings.restrict_to_login '!==' true)}}
{{#or customer (unless settings.hide_price_from_guests)}}
<amp-iframe height="400" width="250"
layout="responsive"
sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation allow-modals"
Expand Down
6 changes: 3 additions & 3 deletions templates/components/cart/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h2 class="cart-item-name">
</td>
<td class="cart-item-block cart-item-info">
<span class="cart-item-label">{{lang 'cart.checkout.price'}}</span>
{{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}}
{{#or ../customer (unless ../settings.hide_price_from_guests) (if type '==' 'GiftCertificate')}}
<span class="cart-item-value {{#if price_discounted}}price--discounted{{/if}}">{{price.formatted}}</span>
{{#if price_discounted}}
<span class="cart-item-value">{{price_discounted.formatted}}</span>
Expand Down Expand Up @@ -140,13 +140,13 @@ <h2 class="cart-item-name">

<td class="cart-item-block cart-item-info">
<span class="cart-item-label">{{lang 'cart.checkout.total'}}</span>
{{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}}
{{#or ../customer (unless ../settings.hide_price_from_guests) (if type '==' 'GiftCertificate')}}
<strong class="cart-item-value {{#if total_discounted}}price--discounted{{/if}}">{{total.formatted}}</strong>
{{#if total_discounted}}
<strong class="cart-item-value">{{total_discounted.formatted}}</strong>
{{/if}}
{{else}}
{{> components/common/login-for-pricing}}
--
{{/or}}
{{#or can_modify (if type '==' 'GiftCertificate')}}
<button class="cart-remove icon"
Expand Down
4 changes: 2 additions & 2 deletions templates/components/cart/preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1 class="modal-header-title">
{{lang 'cart.added_to_cart.order_subtotal'}}

<strong class="previewCartCheckout-price">
{{#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}}
Expand Down Expand Up @@ -75,7 +75,7 @@ <h2 class="productView-title">
</div>

<div class="productView-price">
{{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}}
{{#or ../customer (unless ../settings.hide_price_from_guests)}}
{{quantity}} &times; {{price.formatted}}
{{else}}
{{> components/common/login-for-pricing}}
Expand Down
4 changes: 2 additions & 2 deletions templates/components/cart/totals.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<strong>{{lang 'cart.checkout.subtotal'}}:</strong>
</div>
<div class="cart-total-value">
{{#or customer (if theme_settings.restrict_to_login '!==' true)}}
{{#or customer (unless settings.hide_price_from_guests)}}
<span>{{cart.sub_total.formatted}}</span>
{{else}}
{{> components/common/login-for-pricing}}
Expand Down Expand Up @@ -99,7 +99,7 @@
<strong>{{lang 'cart.checkout.grand_total'}}:</strong>
</div>
<div class="cart-total-value cart-total-grandTotal">
{{#or customer (if theme_settings.restrict_to_login '!==' true)}}
{{#or customer (unless settings.hide_price_from_guests)}}
<span>{{cart.grand_total.formatted}}</span>
{{else}}
{{> components/common/login-for-pricing}}
Expand Down
2 changes: 1 addition & 1 deletion templates/components/common/cart-preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h6 class="previewCartItem-name">
{{#if quantity '>' 1}}
{{quantity}} &times;
{{/if}}
{{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}}
{{#or ../customer (unless ../settings.hide_price_from_guests) (if type '==' 'GiftCertificate')}}
<span{{#if price_discounted}} class="price--discounted"{{/if}}>{{price.formatted}}</span>
{{#if price_discounted}}
{{price_discounted.formatted}}
Expand Down
2 changes: 1 addition & 1 deletion templates/components/common/navigation.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<nav class="navUser">
{{#or customer (unless theme_settings.restrict_to_login)}}
{{#or customer (unless settings.hide_price_from_guests)}}
{{> components/common/currency-selector}}
{{/or}}

Expand Down
2 changes: 1 addition & 1 deletion templates/components/products/add-to-cart.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</div>
<p class="alertBox-column alertBox-message"></p>
</div>
{{#or customer (if theme_settings.restrict_to_login '!==' true)}}
{{#or customer (unless settings.hide_price_from_guests)}}
<div class="add-to-cart-buttons">
<div class="form-action">
<input
Expand Down
6 changes: 3 additions & 3 deletions templates/components/products/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{/each}}"
data-product-brand="{{brand.name}}"
data-product-price="
{{#or customer (unless theme_settings.restrict_to_login)}}
{{#or customer (unless settings.hide_price_from_guests)}}
{{#if price.with_tax}}
{{price.with_tax.value}}
{{else}}
Expand Down Expand Up @@ -92,7 +92,7 @@
{{lang 'products.compare'}} <input type="checkbox" name="products[]" value="{{id}}" id="compare-{{id}}" data-compare-id="{{id}}">
</label>
{{/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}}
<a href="{{url}}" data-event-type="product-click" class="button button--small card-figcaption-button" data-product-id="{{id}}">{{lang 'products.choose_options'}}</a>
Expand Down Expand Up @@ -133,7 +133,7 @@ <h3 class="card-title">
</h3>

<div class="card-text" data-test-info-type="price">
{{#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}}
Expand Down
4 changes: 2 additions & 2 deletions templates/components/products/list-item.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#if settings.data_tag_enabled}}
<article class="listItem" data-event-type="{{event}}" data-entity-id="{{id}}" data-position="{{position}}" data-name="{{name}}" data-product-category="{{#each category}}{{#if @last}}{{this}}{{else}}{{this}}, {{/if}}{{/each}}" data-product-brand="{{brand.name}}" data-product-price="
{{#or customer (unless theme_settings.restrict_to_login)}}
{{#or customer (unless settings.hide_price_from_guests)}}
{{#if price.with_tax}}
{{price.with_tax.value}}
{{else}}
Expand Down Expand Up @@ -91,7 +91,7 @@ <h4 class="listItem-title">
{{/if}}
</div>
<div class="listItem-actions">
{{#or customer (if theme_settings.restrict_to_login '!==' true)}}
{{#or customer (unless settings.hide_price_from_guests)}}
{{#if price}}
<div class="listItem-price">{{> components/products/price price=price}}</div>
{{/if}}
Expand Down
2 changes: 1 addition & 1 deletion templates/components/products/product-info.html
Original file line number Diff line number Diff line change
@@ -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}}
Expand Down
4 changes: 2 additions & 2 deletions templates/components/products/product-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -106,7 +106,7 @@ <h2 class="productView-brand">
</p>
{{/if}}
<div class="productView-price">
{{#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}}
Expand Down
58 changes: 32 additions & 26 deletions templates/pages/cart.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,43 @@

{{{region name="cart_below_totals"}}}

{{#if cart.additional_checkout_buttons}}
<div data-cart-accelerated-checkout-buttons class="cart-acceleratedCheckoutButtons cart-content-padding-right"></div>
{{/if}}
{{#or customer (unless settings.hide_price_from_guests)}}
{{#if cart.additional_checkout_buttons}}
<div data-cart-accelerated-checkout-buttons class="cart-acceleratedCheckoutButtons cart-content-padding-right"></div>
{{/if}}

{{#if cart.show_primary_checkout_button}}
<div class="cart-actions cart-content-padding-right">
<a
class="button button--primary"
href="{{urls.checkout.single_address}}"
title="{{lang 'cart.checkout.title'}}"
data-primary-checkout-now-action
>
{{lang 'cart.checkout.button'}}
</a>
{{#if cart.show_multiple_address_shipping}}
<a class="checkoutMultiple" href="{{urls.checkout.multiple_address}}">
{{lang 'cart.preview.checkout_multiple'}}
{{#if cart.show_primary_checkout_button}}
<div class="cart-actions cart-content-padding-right">
<a
class="button button--primary"
href="{{urls.checkout.single_address}}"
title="{{lang 'cart.checkout.title'}}"
data-primary-checkout-now-action
>
{{lang 'cart.checkout.button'}}
</a>
{{/if}}
</div>
{{#if cart.show_multiple_address_shipping}}
<a class="checkoutMultiple" href="{{urls.checkout.multiple_address}}">
{{lang 'cart.preview.checkout_multiple'}}
</a>
{{/if}}
</div>
{{else}}
<div class="cart-actions cart-content-padding-right">
<a class="button" href="{{urls.home}}" title="{{lang 'cart.continue_shopping'}}">{{lang 'cart.continue_shopping'}}</a>
</div>
{{/if}}

{{#if cart.additional_checkout_buttons}}
<div data-cart-additional-checkout-buttons class="cart-additionalCheckoutButtons cart-content-padding-right">
{{> components/cart/additional-checkout-buttons}}
</div>
{{/if}}
{{else}}
<div class="cart-actions cart-content-padding-right">
<a class="button" href="{{urls.home}}" title="{{lang 'cart.continue_shopping'}}">{{lang 'cart.continue_shopping'}}</a>
</div>
{{/if}}

{{#if cart.additional_checkout_buttons}}
<div data-cart-additional-checkout-buttons class="cart-additionalCheckoutButtons cart-content-padding-right">
{{> components/cart/additional-checkout-buttons}}
<a class="button" href="{{urls.auth.login}}" title="{{lang 'cart.login_to_checkout'}}">{{lang 'cart.login_to_checkout'}}</a>
</div>
{{/if}}
{{/or}}

{{else}}
<h3 tabindex="0">{{lang 'cart.checkout.empty_cart'}}</h3>
Expand Down
4 changes: 2 additions & 2 deletions templates/pages/compare.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1 class="page-heading">{{lang 'compare.header' products=comparisons.length}}</
<h3 class="card-title">
<a href="{{url}}">{{ name }}</a>
</h3>
{{#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}}
Expand All @@ -55,7 +55,7 @@ <h3 class="card-title">
<th class="compareTable-heading"></th>
{{#each comparisons}}
<td class="compareTable-action">
{{#or ../customer (if ../theme_settings.restrict_to_login '!==' true)}}
{{#or ../customer (unless ../settings.hide_price_from_guests)}}
{{#if show_cart_action}}
{{#if has_options}}
<a href="{{url}}" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}} class="button button--primary" data-product-id="{{id}}">{{lang 'products.choose_options'}}</a>
Expand Down

0 comments on commit 87c9966

Please sign in to comment.