How can I replace a flexslider with stacked content in Shopify? - shopify

On the desktop version of our site, we have a 3 column section (the theme calls is text-adverts) with one about pickup, one about delivery, one about shipping. On mobile, it automatically converts to a flexslider with no arrows or really any way of knowing to swipe unless you watch it long enough. I'd much rather just have the 3 stacked so no users miss this critical info.
I've found the code dealing with the text-adverts on mobile but I don't know what to replace it with. Any help is much appreciated.
<div class="container d-block d-md-none">
<div class="row text-advert-section mobile-homepage-text-adverts flexslider text-adverts-alignment--{{ text-advert--alignment }}">
<ul class="slides">
{% for block in section.blocks %}
{%- assign advert_has_link = false -%}
{% if block.settings.link != blank %}
{%- assign advert_has_link = true -%}
{% endif %}
<li {{ block.shopify_attributes }}>
<div class="grid__item text-advert-section__item{% if advert_has_link %} text-advert-section__item--link{% endif %}">
{% if advert_has_link %}<a href="{{ block.settings.link }}">{% endif %}
{% if block.settings.icon != 'none' %}
<div class="text-advert-section__icon-wrapper {{ section.settings.icon-size }}">
<i data-feather="{{ block.settings.icon }}"></i>
</div>
{% endif %}
<div class="text-advert-section__text-wrapper">
{% if block.settings.heading != blank %}
<span class="text-advert-section__header type-subheading type-subheading--1">{{ block.settings.heading | escape }}</span>
{% endif %}
{% if block.settings.subheading != blank %}
<span class="text-advert-section__sub-header h6">{{ block.settings.subheading | escape }}</span>
{% endif %}
</div>
{% if advert_has_link %}</a>{% endif %}
</div>
</li>
{% endfor %}
</ul>
</div>
</div>

The flexslider is being initialised by javascript. So you need to find the script that initialises the slider. Most likely it will look something like this: $('.flexslider').flexslider({})
You should also remove the flexslider class from the div with class text-advert-section - because it shouldn't utilise any flexslider code.

Related

multi tag filter not getting product info in shopify using custom code withou app

i have created custom code sidebar filter. if filter by one tag its working fine, suppose if we click another tag no product details are showing.
Snippet/sidebar-filter.liquid
{% for block in section.blocks %}
{% assign heading = block.settings.filter_heading %}
{% assign tags = block.settings.filter_tags | split: ',' %}
<div class="collection-filter-tag-category">
<h4> {{ heading }} </h4>
<div class="filter-li-scroll">
{% for t in tags %}
{% assign tag = t | strip %}
{% if current_tags contains tag %}
<li class="active">
{{ tag | link_to_remove_tag : tag }}
</li>
{% else %}
<li class="">
{{ tag | link_to_add_tag : tag }}
</li>
{% endif %}
{% endfor %}
</div>
</div>
{% endfor %}
Templates/collection.liquid:
{% section 'collection-template' %}
Templates/collection-template.liquid:
<div id="collection-product-filter-pane">
<div class="sidebar_filter">
{% include 'sidebar-filter' %}
</div>
<div class="page-width" id="Collection">
{% if section.settings.layout == 'grid' %}
{% case section.settings.grid %}
{% when '2' %}
{%- assign grid_item_width = 'medium-up--one-half' -%}
{% when '3' %}
{%- assign grid_item_width = 'small--one-half medium-up--one-third' -%}
{% when '4' %}
{%- assign grid_item_width = 'small--one-half medium-up--one-quarter' -%}
{% when '5' %}
{%- assign grid_item_width = 'small--one-half medium-up--one-fifth' -%}
{% endcase %}
<div class="grid grid--uniform{% if collection.products_count > 0 %} grid--view-items{% endif %}">
{% for product in collection.products %}
<div class="grid__item grid__item--{{section.id}} {{ grid_item_width }}">
{% include 'product-card-grid', max_height: max_height %}
</div>
{% else %}
{% comment %}
Add default products to help with onboarding for collections/all only.
The onboarding styles and products are only loaded if the
store has no products.
{% endcomment %}
{% if collection.handle == 'all' and collection.all_vendors.size == 0 and collection.all_types.size == 0 %}
<div class="grid__item">
<div class="grid grid--uniform">
{% for i in (1..limit) %}
<div class="grid__item {{ grid_item_width }}">
<div class="grid-view-item">
<a href="#" class="grid-view-item__link">
<div class="grid-view-item__image">
{% capture current %}{% cycle 1, 2, 3, 4, 5, 6 %}{% endcapture %}
{{ 'product-' | append: current | placeholder_svg_tag: 'placeholder-svg' }}
</div>
<div class="h4 grid-view-item__title">{{ 'homepage.onboarding.product_title' | t }}</div>
<div class="grid-view-item__meta">
<span class="product-price__price">$19.99</span>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %}
{%- assign is_empty_collection = true -%}
{% endif %}
{% endfor %}
</div>
{% else %}
<div class="list-view-items">
{% for product in collection.products %}
<a href="{{ product.url | within: collection }}" class="list-view-item">
{% include 'product-card-list', product: product %}
</a>
{% else %}
{% comment %}
Add default products to help with onboarding for collections/all only.
The onboarding styles and products are only loaded if the
store has no products.
{% endcomment %}
{% if collection.handle == 'all' and collection.all_vendors.size == 0 and collection.all_types.size == 0%}
{% for i in (1..4) %}
<a href="#" class="list-view-item">
<div class="list-view-item__image-column">
<div class="list-view-item__image-wrapper">
<div class="list-view-item__image">
{%- assign placeholder = 'placeholder-product-' | append: i -%}
{% include placeholder %}
</div>
</div>
</div>
<div class="list-view-item__title-column">
<div class="list-view-item__title">{{ 'homepage.onboarding.product_title' | t }}</div>
</div>
<div class="list-view-item__price-column">
<span class="product-price__price">$19.99</span>
</div>
</a>
{% endfor %}
{% else %}
{%- assign is_empty_collection = true -%}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% if is_empty_collection %}
<div class="grid__item small--text-center">
<p class="text-center">{{ 'collections.general.no_matches' | t }}</p>
</div>
{% endif %}
{% if paginate.pages > 1 %}
{% include 'pagination' %}
{% endif %}
</div>
</div>
if filter by another tag no product list coming
please help me to get result, I'm stucking two days pls someone help me

Shopify liquid :How to get variant inventory from ajax cart

This question sounds similar to my own question cart-template-variant. I am doing the same thing with ajax cart header.liquid. I just wanted to access inventory from cart object same as cart-template question {% if item.variant.inventory_quantity < 1 %}. I am initially trying to print {{item.variant.inventory_quantity}} into header.liquid since it is ajax cart. inside {% for item in cart.items %} I have printed {{item.variant.inventory_quantity}} but when I add in stock or out of stock product into the cart. It always returns 0. Which is the cart object property I am not passing properly?
I am actually following below advise but I have missed something here.
The code for Ajax cart is in header.liquid. It has a Cart object, which has many properties. See https://help.shopify.com/themes/liquid/objects/cart#cart-items
One of them is items (i.e. cart.items), which gives all the items added to cart. Around line 100, you will see a for loop {% for item in cart.items %}.
Here item = line_item. The line_item has many properties. See https://help.shopify.com/themes/liquid/objects/line_item.
One of them is variant. i.e. line_item.variant. So here inside for loop will be item.variant.
So now you have variant properties. See https://help.shopify.com/themes/liquid/objects/variant
variant.inventory_quantity is one of them.
header.liquid (Ready to share entire file if required.)
<form action="/checkout" method="post" id="cart">
<ul data-money-format="{{ shop.money_format }}" data-shop-currency="{{ shop.currency }}" data-shop-name="{{ shop.name | escape }}">
<li class="mm-subtitle"><a class="continue ss-icon" href="#cart"><span class="icon-close"></span></a></li>
{% if cart.item_count == 0 %}
<li class="empty_cart">{{ 'layout.general.empty_cart' | t }}</li>
{% else %}
{% for item in cart.items %}
{{item.variant.inventory_quantity}}
<a href="/#" >Will be dispatched by June 7</a>
<li class="cart_item {% if forloop.last %}last_cart_item{% endif %}">
<p class="mm-counter">
<span class="icon-minus minus"></span><input type="number" min="0" class="quantity" name="updates[]" id="updates_{{ item.id }}" value="{{ item.quantity }}" data-line-id="{{ forloop.index }}" readonly /><span class="icon-plus plus"></span>
</p>
<a href="{{ item.url }}">
{% if item.image %}
<div class="cart_image">
<img src="{{ item | img_url: '410x' }}" alt="{{ item.title | escape }}" />
</div>
{% endif %}
<div class="item_info">
{{ item.product.title }}
{% unless item.product.has_only_default_variant or item.variant.title contains "Title" %}
{% for option in item.product.options %}
{% unless option contains "Title" %}
- {{ item.variant.options[forloop.index0] }} {% unless forloop.last %}/{% endunless %}
{% endunless %}
{% endfor %}
{% endunless %}
{% if item.properties %}
{% for p in item.properties %}
{% if p.last != blank %}
<div class="line-item">
{{ p.first }}: {{ p.last }}
</div>
{% endif %}
{% endfor %}
{% endif %}
<div class="price">
<span class="money">{{ item.price | money }}</span>
</div>
</div>
</a>
</li>
{% endfor %}
<li class="mm-label">
<p class="mm-counter price">
<span class="money">{{ cart.total_price | money }}</span>
</p>
<a href="/cart">
<strong>{{ 'layout.general.subtotal' | t }}</strong>
</a>
</li>
<li class="mm-subtitle clearfix">
{% if settings.display_special_instructions %}
<textarea id="cart-note" name="note" rows="2" placeholder="{{ 'layout.general.cart_note' | t }}" class="clearfix">{{ cart.note }}</textarea>
{% endif %}
{% if settings.display_tos_checkbox %}
<aside class="tos tos_checkbox">
<input type="checkbox" class="tos_agree" id="sliding_agree" required />
<label class="tos_label" for="sliding_agree">
{{ settings.tos_richtext }}
</label>
</aside>
{% endif %}
<input type="submit" class="action_button right" value="{{ 'layout.general.checkout' | t }}" />
{{ 'layout.general.edit_cart' | t }}
</li>
{% endif %}
</ul>
</form>

How to create third level menu (Shopify)

Can you please guide me, How to create third level menu in shopify.
Sub Dropdown Menu for (Almost) Any Shopify theme.
Thanks in advance.
In navigation:
If your Shopify backend updated then simple drag and drag upto three level
see: screenshot http://prntscr.com/hzu8n3
Or use as create new menu with same handle of sub menu.
And use below code
<div class="menuItems">
<ul class="mebItemParent">
{% for link in linklists.mobile-menu.links %}
{% if linklists[link.handle] == empty %}
<li class="">{{ link.title }}</li>
{% else %}
<li class="hasSubItem">
<div class="withtiggle">
{{ link.title }} <span class="toggleItem">+</span>
</div>
<ul>
{% for l in linklists[link.handle].links %}
{% if linklists[l.handle] == empty %}
<li class="">{{ l.title }}</li>
{% else %}
<li class="hasSubItem">
<div class="withtiggle">
{{ l.title }} <span class="toggleItem">+</span>
</div>
<ul>
{% for l2 in linklists[link.handle].links %}
<li class="">{{ l2.title }}</li>
{% endfor %}
</ul>
</li>
{% endif %}
{% endfor %}
</ul>
</li>
{% endif %}
{% endfor %}
</ul>
</div>

Shopify Wishlist memory issue

We have below code in our shopify app, however it is not working and we are getting error as :
Liquid error: Memory limits exceeded
The code loops through the customer tags and checks for product id in collections and displays the products.
Can anyone please help with identifying the issue?
{% include 'breadcrumb' %}
<div class="container">
<div class="page">
<div class="title">
<h2>{{ page.title }}</h2>
</div>
<div class="page_content">
{{ page.content }}
</div>
{% if customer %}
<ul class="wishlist-items">
<li class="head">
<ul>
<li class="col-1 hidden-xs">{{'wish_list.general.image' | t}}</li>
<li class="col-2">{{'wish_list.general.item' | t}}</li>
<li class="col-3">{{'wish_list.general.price' | t}}</li>
<li class="col-4"></li>
</ul>
</li>
<li class="tbody">
<ul>
{% for tag in customer.tags %}
{% assign the_test = '' %}
{% capture tagID %}{{ tag }}{% endcapture %}
{% for tag in customer.tags %}
{% capture curTag %}{{ tag }}{% endcapture %}
{% if curTag contains tagID %}
{% assign tagID_tmp = tagID.size | minus:curTag.size %}
{% if tagID_tmp == 0 %}
{% assign the_test = tagID %}
{% else %}
{% assign the_test = '' %}
{% endif %}
{% endif %}
{% endfor %}
{% for collection in collections %}
{% paginate collection.products by collection.all_products_count %}
{% for product in collection.products %}
{% capture productID %}{{ product.id }}{% endcapture %}
{% capture used %}{{ productID }} {{ used }}{% endcapture %}
{% unless used contains productID %}
{% assign check = tag.size | minus:productID.size | modulo:2 %}
{% if check == 0 %}{% assign display_product = true %}{% else %}{% assign display_product = false %}{% endif %}
{% if display_product and the_test contains productID %}
{% assign variant_tmp = product.selected_or_first_available_variant %}
{% for variant in product.variants %}
{% if variant.available == true and variant.price < variant_tmp.price %}
{% assign variant_tmp = variant %}
{% endif %}
{% endfor %}
<li class="item">
<ul>
<li class="col-1 hidden-xs">
<a href="{{product.url | within: collection}}" class="product-image">
<img src="{{product.featured_image | product_img_url:'medium'}}" alt="{{product.title}}" />
</a>
</li>
<li class="col-2">
<a href="{{product.url | within: collection}}" class="product-image visible-xs">
<img src="{{product.featured_image | product_img_url:'medium'}}" alt="{{product.title}}" />
</a>
{{product.title}}{% if product.variants.size > 1 %} - {{variant_tmp.title}}{% endif %}
</li>
<li class="col-3"><div class="product-price"><span class="money">{{product.price | money}}</span></div></li>
<li class="col-4">
<div class="action">
<div class="wishlist">
{% form 'customer' %}
<input type='hidden' name='contact[email]' value='{{ customer.email }}'/>
<input type='hidden' name='contact[tags]' id='remove-value' value='x{{ tagID }}' />
<button type="submit" class="remove-wishlist"><i class="fa fa-close"></i></button>
{% endform %}
</div> |
<div class="addtocart">
{% if product.available %}
<form action="/cart/add" method="post" enctype="multipart/form-data">
<input type="hidden" name="quantity" value="1" />
<input type="hidden" name="id" value="{{variant_tmp.id}}" />
<button type="submit" class="add-to-cart"><i class="fa fa-shopping-cart"></i></button>
</form>
{% else %}
<i class="fa fa-shopping-cart"></i>
{% endif %}
</div>
</div>
</li>
</ul>
</li>
{% endif %}
{% endunless %}
{% endfor %}
{% endpaginate %}
{% endfor %}
{% endfor %}
</ul>
</li>
</ul>
{% else %}
<p>{{'wish_list.general.to_create_a_wishlist_please' | t}} <a href='/account/login'>{{'wish_list.general.login' | t}}</a> {{'wish_list.general.or' | t}} <a href='/account/register'>{{'wish_list.general.register' | t}}</a>.</p>
{% endif %}
</div>
</div>
This is because of many nested loops. All the products must be sorted out, so developers used this huge construction:
{% for collection in collections %}
{% paginate collection.products by collection.all_products_count %}
{% for product in collection.products %}
...
{% endpaginate %}
{% endfor %}
{% endfor %}
I got this error on one of our clients shop.
But we can use Shopify liquid all_products['the-handle'].variable!
Original customer tags wishlist uses products ID and x. I used product handle instead of product ID and +0 instead of x.
Customer tags with Product ID:
12345678
x12345678
xx12345678
Customer tags with handles:
some-product-handle
+0some-product-handle
+0+0some-product-handle
I had to change the code, spent a lot of time, but now it works fine, without any errors.

Hubspot custom module to query blog posts

I am working on a Hubspot COS website and I need to be able to run custom queries on blog posts and display a list of those blog posts in a module on the home page and in the sidebar on the website.
Where do I start? I have tried using the RSS module, but it is not specific enough for my needs.
If you have any advise it would be much appreciated. Thanks!
I was able to use blog_recent_topic_posts() to solve this problem:
<div class="row-fluid">
{% set posts = blog_recent_topic_posts('3904474513', 'featured-resource', 3) %}
{% for post in posts %}
{% set topics = post.topic_list %}
<div class="span4 resource">
<div class="resource-icon{% for topic in topics %} {{ topic.slug }}{% endfor %}"></div>
<img src="{{ post.featured_image }}" alt="{{ post.name }}">
<div class="resource-text">
<p class="r-type">
{% for topic in topics %}
{% unless topic == 'featured resource' %}
{{ topic.name }}
{% endunless %}
{% endfor %}
</p>
<h3 class="r-title">{{ post.name }}</h3>
</div>
</div>
{% endfor %}
</div>