Skip to content

Instantly share code, notes, and snippets.

@dpw1
dpw1 / ezfy-arrow-keys.liquid
Last active June 7, 2023 16:26
How to change product images with arrow keys
{% if template == 'product' %}
<script>
document.addEventListener('keydown', function (event) {
function isThumbnailsOrArrows(){
// has arrows
if (window.getComputedStyle(document.querySelector(`.slider-buttons`)).display !== 'none'){
return 'arrows';
}
@dpw1
dpw1 / image-banner.liquid
Last active February 18, 2024 02:55
How to make the image banner clickable [all free themes]
<a class="ezfy-clickable-banner" href="{{ block.settings.button_link_1 }}"></a>
<style>
[id*='{{ section.id }}'].banner{
position: relative;
cursor: pointer;
}
</style>
<script>(() => {
@dpw1
dpw1 / main-product.liquid
Last active March 3, 2024 23:44
Change how many variants are shown per row
{% assign variants_per_row_desktop = 4 %}
{% assign variants_per_row_mobile = 3 %}
<style>
@media (min-width: 750px){
[id*='ProductInfo-'] variant-radios fieldset,
[id*='ProductInfo-'] variant-selects fieldset{
display: grid;
grid-template-columns: repeat(auto-fill, minmax(calc(100% / {{ variants_per_row_desktop }}), 1fr));
}
@dpw1
dpw1 / base.css
Last active September 4, 2023 08:16
Show mobile slideshow's text on top of image
{% if section.settings.show_on_top_of_image_on_mobile_by_ezfycode %}
<style>
/* Custom code by ezfycode.com
Fix mobile banner and slideshow [start]
===================================== */
{% assign _mobile_banner_background = section.settings.mobile_banner_background | color_to_rgb %}
{% assign mobile_banner_background_opacity = section.settings.mobile_banner_background_opacity | prepend: ',.' | append: ')' %}
{% capture mobile_banner_background %}
{% if section.settings.mobile_banner_background_opacity == 100 %}
{{ section.settings.mobile_banner_background }}
@dpw1
dpw1 / card-product.liquid
Last active March 4, 2024 17:28
Choose which image to show on hover (instead of the second one)
{% assign second_image_number = 3 %}
{% assign image_to_show = second_image_number | minus:1 %}
{% assign ezfy_image_on_hover = card_product.media[image_to_show] %}
<img
srcset="
{%- if ezfy_image_on_hover.width >= 165 -%}{{ ezfy_image_on_hover | image_url: width: 165 }} 165w,{%- endif -%}
@dpw1
dpw1 / ezfy-custom-fonts.liquid
Created December 6, 2022 21:19
How to add custom fonts to any Shopify theme
{% if section.settings.enable %}
<style data-custom-fonts>
{% assign items = section.blocks | reverse %}
{% for block in items %}
{% assign name = block.settings.name %}
{% assign url = block.settings.custom_font_url %}
@dpw1
dpw1 / ezfy-header-search.liquid
Last active March 7, 2023 18:48
EZFY Search
<div class=" EzfySearch EzfySearch--{{ search_type }} search-modal__content{% if settings.inputs_shadow_vertical_offset != 0 and settings.inputs_shadow_vertical_offset < 0 %} search-modal__content-top{% else %} search-modal__content-bottom{% endif %}" tabindex="-1">
{%- if settings.predictive_search_enabled -%}
<predictive-search class="search-modal__form" data-loading-text="{{ 'accessibility.loading' | t }}">
{%- else -%}
<search-form class="search-modal__form">
{%- endif -%}
<form action="{{ routes.search_url }}" method="get" role="search" class="search search-modal__form">
<div class="field">
<input class="search__input field__input"
@dpw1
dpw1 / header.liquid
Last active September 2, 2023 01:55
Menu word on mobile
<div class="menu__hamburguer--container" >
<span>
{% render 'icon-hamburger' %}
{% render 'icon-close' %}
</span>
<span class="menu__hamburguer--text">Menu</span>
</div>
<style>
.menu__hamburguer--container{
position: relative;
@dpw1
dpw1 / ezfy-hide-sold-out.liquid
Created October 24, 2022 12:23
ezfycode.com/blog/how-to-hide-out-of-stock-products
<style>
[id] .collection .grid__item--is-sold-out{
display: none;
}
.collection-page--ezfy .loading-overlay{
display: none !important;
}
</style>
<script>
@dpw1
dpw1 / ezfy-collection-filter.liquid
Last active March 6, 2024 03:00
How to remove options from the collection filter
<script>
const REMOVE = `manual, best-selling`;
window.ezfyCollectionFilter = window.ezfyCollectionFilter || {};
ezfyCollectionFilter = (function () {
function _isCartPage() {