← back to Dw Theme Compact Toolbar

sections/home-product.liquid

298 lines

{% assign product = nil %}

{% if section.settings.product_handle != blank %}
  {% assign product = all_products[section.settings.product_handle] %}
{% endif %}

{% assign show_social_media_icons = section.settings.show_social_media_icons %}
{% assign show_payment_button = section.settings.show_payment_button %}
{% assign images_layout = section.settings.images_layout %}
{% assign enable_zoom = section.settings.enable_zoom %}
{% assign enable_cart_redirection = section.settings.enable_cart_redirection %}
{% assign enable_video_autoplay = section.settings.enable_video_autoplay %}
{% assign enable_video_looping = section.settings.enable_video_looping %}


<script
  type="application/json"
  data-section-type="product"
  data-section-id="{{ section.id }}"
  data-section-data
>
  {
    "product": {{ product | json }},
    "product_settings": {
      "addToCartText": {{ 'products.product.add_to_cart' | t | json }},
      "enableHistory": false,
      "processingText": {{ 'products.product.processing' | t | json }},
      "setQuantityText": {{ 'products.product.set_quantity' | t | json }},
      "soldOutText": {{ 'products.product.sold_out' | t | json }},
      "unavailableText": {{ 'products.product.unavailable' | t | json }}
    },
    "images_layout": {{ images_layout | json }},
    "enable_zoom": {{ enable_zoom | json }},
    "enable_video_autoplay": {{ enable_video_autoplay | json }},
    "enable_video_looping": {{ enable_video_looping | json }},
    "enable_cart_redirection": {{ enable_cart_redirection | json }},
    "enable_fixed_positioning": false
  }
</script>

{% render 'product-success-labels' %}

<section class="product-container">
  {%
    render 'product',
    product: product,
    show_social_media_icons: show_social_media_icons,
    images_layout: images_layout,
    enable_zoom: enable_zoom,
    enable_linked_options: true,
    show_payment_button: show_payment_button,
  %}
</section>

{% schema %}
{
  "name": "Featured product",
  "class": "shopify-section--featured-product",
  "settings": [
    {
      "type": "product",
      "id": "product_handle",
      "label": "Product"
    },
    {
      "type": "checkbox",
      "id": "enable_cart_redirection",
      "label": "Enable cart redirection",
      "info": "Automatically sends users to the Cart page after adding a product.",
      "default": false
    },
    {
      "type": "checkbox",
      "id": "show_payment_button",
      "label": "Show dynamic checkout button",
      "info": "Each customer will see their preferred payment method from those available on your store, such as PayPal or Apple Pay. [Learn more](https://help.shopify.com/manual/using-themes/change-the-layout/dynamic-checkout)",
      "default": true
    },
    {
      "type": "header",
      "content": "Media"
    },
    {
      "type": "paragraph",
      "content": "Learn more about [media types](https://help.shopify.com/en/manual/products/product-media/product-media-types)"
    },
    {
      "type": "select",
      "id": "images_layout",
      "label": "Layout",
      "options": [
        {
          "label": "Slideshow",
          "value": "slideshow"
        },
        {
          "label": "List",
          "value": "list"
        },
        {
          "label": "Masonry",
          "value": "masonry"
        }
      ],
      "default": "slideshow"
    },
    {
      "type": "checkbox",
      "id": "enable_zoom",
      "label": "Enable image zoom",
      "info": "Zoom only works with the slideshow image layout"
    },
    {
      "type": "checkbox",
      "id": "enable_video_autoplay",
      "label": "Enable video autoplay",
      "default": true
    },
    {
      "type": "checkbox",
      "id": "enable_video_looping",
      "label": "Enable video looping"
    }
  ],
  "blocks": [
    {
      "type": "@app"
    },
    {
      "type": "collapsible-tab",
      "name": "Collapsible tab",
      "settings": [
        {
          "type": "text",
          "id": "collapsible_tab_heading",
          "label": "Heading",
          "default": "Collapsible tab"
        },
        {
          "type": "richtext",
          "id": "collapsible_tab_text",
          "label": "Text",
          "default": "<p>Use this text to share information about your product.</p>"
        }
      ]
    },
    {
      "type": "custom-liquid",
      "name": "Custom liquid",
      "settings": [
        {
          "type": "liquid",
          "id": "custom_liquid",
          "label": "Custom liquid",
          "info": "Add app snippets or other Liquid code to create advanced customizations."
        }
      ]
    },
    {
      "type": "tabs",
      "name": "Tabs",
      "limit": 1,
      "settings": [
        {
          "type": "checkbox",
          "id": "show_product_description",
          "label": "Show product description",
          "default": false
        },
        {
          "type": "header",
          "content": "Tab"
        },
        {
          "type": "text",
          "id": "tab_heading_1",
          "label": "Heading",
          "default": "Tab 1"
        },
        {
          "type": "richtext",
          "id": "tab_text_1",
          "label": "Text",
          "default": "<p>Tab 1 content goes here.</p>"
        },
        {
          "type": "header",
          "content": "Tab"
        },
        {
          "type": "text",
          "id": "tab_heading_2",
          "label": "Heading",
          "default": "Tab 2"
        },
        {
          "type": "richtext",
          "id": "tab_text_2",
          "label": "Text",
          "default": "<p>Tab 2 content goes here.</p>"
        },
        {
          "type": "header",
          "content": "Tab"
        },
        {
          "type": "text",
          "id": "tab_heading_3",
          "label": "Heading",
          "default": "Tab 3"
        },
        {
          "type": "richtext",
          "id": "tab_text_3",
          "label": "Text",
          "default": "<p>Tab 3 content goes here.</p>"
        }
      ]
    },
    {
      "type": "title",
      "name": "Title",
      "limit": 1
    },
    {
      "type": "vendor",
      "name": "Vendor",
      "limit": 1
    },
    {
      "type": "social",
      "name": "Social",
      "limit": 1
    },
    {
      "type": "description",
      "name": "Description",
      "limit": 1
    },
    {
      "type": "price",
      "name": "Price",
      "limit": 1
    },
    {
      "type": "form",
      "name": "Form",
      "limit": 1,
      "settings": [
        {
          "type": "paragraph",
          "content": "Customize form features for the product in the products portion of the theme settings."
        }
      ]
    },
    {
      "type": "rating",
      "name": "Product rating",
      "limit": 1,
      "settings": [
        {
          "type": "paragraph",
          "content": "To display a rating, add a product rating app. [Learn more](https://apps.shopify.com/product-reviews)"
        }
      ]
    }
  ],
  "presets": [
    {
      "category": "Product",
      "name": "Featured product",
      "blocks": [
        {
          "type": "vendor"
        },
        {
          "type": "title"
        },
        {
          "type": "price"
        },
        {
          "type": "form"
        },
        {
          "type": "description"
        }
      ]
    }
  ],
  "disabled_on": {
    "groups": [
      "*"
    ]
  }
}

{% endschema %}