Kriuchko
4/24/2019 - 7:56 AM

Custom title and subtitle

\!h custom.js

/* Hide default product title on preview card */
function initHideTitle() {
    $('.product-preview-card').each(function hideTitle() {
        if($(this).find('.preview-title').length){
            $(this).find('.main-title').addClass('hidden');
        }
    });
}
initHideTitle();

\!h html
{{#each custom_fields}}
    {{#if name '==' 'preview_title' }}
        <h3 class="preview-title"><a href="{{../../url}}" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}}>{{value}}</a></h3>
    {{else}}
    {{/if}}
    {{#if name '==' 'preview_subtitle' }}
        <h4 class="subtitle">{{value}}</h4>
    {{/if}}
{{/each}}

<h3 class="main-title">
    {{#if demo}}
        {{name}}
    {{else}}
        <a href="{{url}}" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}}>{{name}}</a>
    {{/if}}
</h3>