Kriuchko
12/14/2018 - 3:37 PM

IF OR ELSE exaples

BigCommerce conditions in templates

\!h IF if

== 	equal to
=== 	equal to and equal type
!= 	not equal
< 	less than
> 	greater than
<= 	less than or equal to
>=

{{#if head.title '==' 'Page One'}}
        <!-- do something -->
{{else if head.title "==" 'Random Page'}}
        <!-- do something else --> 
{{else}}
        <!-- do default --> 
{{/if}}

<li class="
	{{#if product.custom_fields }}
      	{{#each product.custom_fields as |product_field| }}
        	{{#if product_field.name '==' 'category_preview' }}
        		{{#if product_field.value '==' 'wide' }}
             	    grid__item small--one-whole medium-up--one-half half-grid
             	{{/if}}
           	{{/if}}
        {{/each}}
    {{else}}
        grid__item small--one-half medium-up--one-quarter
    {{/if}}
">
    
\!h if not
{{#if (not theme_settings.hide_categories_links)}}
<!-- do something else --> 
{{/if}}


\!h OR or

{{#or customer (if theme_settings.restrict_to_login '!==' true)}}

{{/or}}

{{#if theme_settings.instagram_feed}}

	<section class="instagram">
		<div class="container">
			
			{{#or theme_settings.instagram_title theme_settings.instagram_subtitle}}
				<div class="instagram__title">

					{{#if theme_settings.instagram_title}}<h2 class="h2">{{ theme_settings.instagram_title }}</h2>{{/if}}

					{{#if theme_settings.instagram_subtitle}}<span class="instagram__sub-title">{{ theme_settings.instagram_subtitle }}</span>{{/if}}

				</div>
			{{/or}}

			<div class="imstagram-wrap">
				<script src="https://apps.elfsight.com/p/platform.js" defer></script><div class="elfsight-app-08539a92-7cf7-490a-9b17-a8b811f000ce"></div>
			</div>

		</div>
	</section>

{{/if}}