Skip to content

Commit

Permalink
fix(storefront): BCTHEME-906 Hide prices for aria-label and data-prod…
Browse files Browse the repository at this point in the history
…uct-price attributes if set to Hidden for guests
  • Loading branch information
“bc-yevhenii-buliuk” committed Oct 12, 2021
1 parent 31ac15a commit fe73708
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Hide prices for aria-label and data-product-price attributes if set to "Hidden for guests". [#2131](https://github.com/bigcommerce/cornerstone/pull/2131)
- Added settings for payment banners. [#2021](https://github.com/bigcommerce/cornerstone/pull/2021)
- Use https:// for schema markup. [#2039](https://github.com/bigcommerce/cornerstone/pull/2039)
- Update focus tooltip styles contrast to achieve accessibility AA Complaince. [#2047](https://github.com/bigcommerce/cornerstone/pull/2047)
Expand Down
27 changes: 21 additions & 6 deletions templates/components/products/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
{{/each}}"
data-product-brand="{{brand.name}}"
data-product-price="
{{#if price.with_tax}}
{{price.with_tax.value}}
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{#if price.with_tax}}
{{price.with_tax.value}}
{{else}}
{{price.without_tax.value}}
{{/if}}
{{else}}
{{price.without_tax.value}}
{{/if}}"
Log in for pricing
{{/or}}"
{{/if}}>
<figure class="card-figure">
{{#if stock_level '===' 0}}
Expand All @@ -39,9 +43,15 @@
}}
{{/or}}
{{/if}}

<a href="{{url}}"
class="card-figure__link"
aria-label="{{name}},{{> components/products/product-aria-label}}"
aria-label="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{name}},{{> components/products/product-aria-label}}
{{else}}
{{name}}
{{/or}}"
{{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}}
>
<div class="card-img-container">
Expand Down Expand Up @@ -103,7 +113,12 @@
<p class="card-text" data-test-info-type="brandName">{{brand.name}}</p>
{{/if}}
<h3 class="card-title">
<a aria-label="{{name}},{{> components/products/product-aria-label}}"
<a aria-label="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{name}},{{> components/products/product-aria-label}}
{{else}}
{{name}}
{{/or}}"
href="{{url}}"
{{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}}>{{name}}</a>
</h3>
Expand Down
25 changes: 22 additions & 3 deletions templates/components/products/list-item.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
{{#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="{{#if price.with_tax}}{{price.with_tax.value}}{{else}}{{price.without_tax.value}}{{/if}}">
<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 (if theme_settings.restrict_to_login '===' false)}}
{{#if price.with_tax}}
{{price.with_tax.value}}
{{else}}
{{price.without_tax.value}}
{{/if}}
{{else}}
Log in for pricing
{{/or}}">
{{else}}
<article class="listItem">
{{/if}}
<figure class="listItem-figure">
<a href="{{url}}"
class="listItem-figure__link"
aria-label="{{name}},{{> components/products/product-aria-label}}"
aria-label="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{name}},{{> components/products/product-aria-label}}
{{else}}
{{name}}
{{/or}}"
{{#if settings.data_tag_enabled}}
data-event-type="product-click"
{{/if}}
Expand Down Expand Up @@ -53,7 +67,12 @@
{{/if}}
<h4 class="listItem-title">
<a href="{{url}}"
aria-label="{{name}},{{> components/products/product-aria-label}}"
aria-label="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{name}},{{> components/products/product-aria-label}}
{{else}}
{{name}}
{{/or}}"
{{#if settings.data_tag_enabled}}
data-event-type="product-click"
{{/if}}
Expand Down
13 changes: 12 additions & 1 deletion templates/components/products/product-view.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<div class="productView" {{#if settings.data_tag_enabled}} data-event-type="product" data-entity-id="{{product.id}}" data-name="{{product.title}}" data-product-category="{{#each product.category}}{{#if @last}}{{this}}{{else}}{{this}}, {{/if}}{{/each}}" data-product-brand="{{product.brand.name}}" data-product-price="{{#if product.price.with_tax}}{{product.price.with_tax.value}}{{else}}{{product.price.without_tax.value}}{{/if}}" data-product-variant="single-product-option"{{/if}}>
<div class="productView" {{#if settings.data_tag_enabled}} data-event-type="product" data-entity-id="{{product.id}}" data-name="{{product.title}}" data-product-category="{{#each product.category}}{{#if @last}}{{this}}{{else}}{{this}}, {{/if}}{{/each}}" data-product-brand="{{product.brand.name}}"
data-product-price="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{#if product.price.with_tax}}
{{product.price.with_tax.value}}
{{else}}
{{product.price.without_tax.value}}
{{/if}}
{{else}}
Log in for pricing
{{/or}}"
data-product-variant="single-product-option"{{/if}}>
{{#each product.reviews.messages}}
{{#if error}}
{{> components/common/alert/alert-error error}}
Expand Down

0 comments on commit fe73708

Please sign in to comment.