I created a modal and pasted code in product-template.liquid
Now when I have pasted that code inside my template file and tried testing it. It automatically opens up add to cart page with modal pop up.
PFB liquid code i added and help me out of this.
“Note: i have red coloured to the changes i made for adding modal.”
{%- assign current_variant = product.selected_or_first_available_variant -%}
{% assign variantCount = product.variants | size %}
{% else %}
{% if enable_compare_color and show_compare_color %}
{% endif %}{% render ‘product-label’, product: product, badge_detail: true, serial: 1 %}
{% if section.settings.enable_zoom_text %}
{% render 'multilang' with settings.ask_an_expert %}
{% render 'multilang' with product.title %}
{% if collection %}{% if section.settings.display_product_reviews or section.settings.show_sold_in %}
{% if section.settings.show_sold_in and current_variant.available %}
{% if section.settings.display_vendor or section.settings.display_availability or section.settings.display_product_sku or section.settings.display_product_type %}
{% if section.settings.display_product_sku %}
{% if section.settings.display_availability %}
{% if section.settings.display_product_type %}
{% if section.settings.option_countdown == ‘all_product’ %}
{% assign count_down_final = section.settings.count_down_timer %}
{% if section.settings.countdown == ‘countdown_1’ %}
{% else %}
{% render ‘countdown-progressbar’, count_down_final: count_down_final %}
{% endif %}
{% else %}
{% if product.metafields.c_f.countdown %}
{% capture count_down_final %}{{ product.metafields.c_f.countdown }}{% endcapture %}
{% if section.settings.countdown == ‘countdown_1’ %}
{% endif %}
{% endif %}
{% if section.settings.custombox_text != blank %}
{% endif %}
{% endif %}
{% if section.settings.show_desc == ‘short’ %}
{% if product.metafields.c_f[‘Short Description’] %}
{% assign des = product.metafields.c_f[‘Short Description’] %}
{% assign word_numbeer = 1000000000 %}
{% endif %}
{% elsif section.settings.show_desc == ‘full’ %}
{% form ‘product’, product, id: “add-to-cart-form”, novalidate: ‘novalidate’ %}
{% if settings.display_size_chart %}
{% render 'multilang' with settings.size_guide_text %} {% endif %}/* The Modal (background) /
.modal {
display: none; / Hidden by default /
position: fixed; / Stay in place /
z-index: 1; / Sit on top /
padding-top: 100px; / Location of the box /
left: 0px;
top: 0;
width: 100%; / Full width /
height: 100%; / Full height /
overflow: auto; / Enable scroll if needed /
background-color: rgb(0,0,0); / Fallback color /
background-color: rgba(0,0,0,0.4); / Black w/ opacity */
}
/* Modal Content */
.modal-content {
background-color: #000000;
margin: auto;
padding: 10px;
border: 1px solid #888;
width: 50%;
}
/* The Close Button */
.close {
color: #ffffff;
float: top;
font-size: 30px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #a7a7a7;
text-decoration: none;
cursor: pointer;
}
SHADE FINDER
{% if settings.use_color_swatch %}
{% for option in product.options %}
{% render ‘swatch’ with option %}
{% endfor %}
{% endif %}
{% else %}
{% endif %}
{% if enable_hot_stock and product.variants.size > 0 and product.variants.first.title != ‘Default Title’ %}
{% assign max_stock = section.settings.number_stock | plus: 0 %}
{% if settings.enable_checkbox %}
{% if current_variant.inventory_management %}
{% assign first_inventory = current_variant.inventory_quantity %}
{% if first_inventory > 0 %}
<input data-btn-addToCart type=“submit” name=“add” class=“btn” {% if settings.enable_multilang %}data-translate=“products.product.add_to_cart”{%endif%} id=“product-add-to-cart” value=“{{ ‘products.product.add_to_cart’ | t }}” data-form-id=“#add-to-cart-form”>
{% else %}
<input data-btn-addToCart type=“submit” name=“add” class=“btn” {% if settings.enable_multilang %}data-translate=“products.product.pre_order”{%endif%} id=“product-add-to-cart” value=“{{ ‘products.product.pre_order’ | t }}” data-form-id=“#add-to-cart-form”>
{% endif %}
{% else %}
<input data-btn-addToCart type=“submit” name=“add” class=“btn” {% if settings.enable_multilang %}data-translate=“products.product.add_to_cart”{%endif%} id=“product-add-to-cart” value=“{{ ‘products.product.add_to_cart’ | t }}” data-form-id=“#add-to-cart-form”>
{% endif %}
{% else %}
<input type=“submit” name=“add” class=“btn” {% if settings.enable_multilang %}data-translate=“products.product.unavailable”{%endif%} id=“product-add-to-cart” disabled value=“{{ ‘products.product.unavailable’ | t }}” >
{% endif %}
{% render ‘wishlist-product’, skin_1: true, product: product %}
{% if section.settings.display_product_detail_share %}
{% render ‘icon-share’ %}
{% endif %}
{{ 'products.product.copy_link' | t }}
{% render 'icon-close' %}{% if current_variant.inventory_management %}
{% assign first_inventory = current_variant.inventory_quantity %}
{% if first_inventory > 0 %}
{% else %}
{% endif %}
{% else %}
{% endif %}
{% else %}
{% endif %}
{% render ‘wishlist-product’, skin-1: true, product: product %}
{% if section.settings.display_product_detail_share %}
{% render ‘icon-share’ %}
{% endif %}
{% if section.settings.enable_payment_button and current_variant.available %}
{{ form | payment_button }}
{% endif %}
{{ 'products.product.copy_link' | t }}
{% render 'icon-close' %}{% if section.settings.display_subtotal and product.available and section.settings.display_qty %}
{% endform %}
{% render ‘nofify-sold-out’, product: product, variantCount: variantCount, current_variant: current_variant %}
{% if section.settings.dpl_customers_view %}
{% if section.settings.display_product_detail_tag %}
{% if section.settings.display_trust_img and settings.img_trust != blank %}
{% render ‘tab-vertical-for-skin-1’ %}
{% render ‘product-banner’ %}
{% render ‘product-detail-gallery_lookbook’%}
{% assign blocks = section.blocks | where: ‘type’, ‘recommend’ %}
{% assign block = blocks[0] %}
{% if block.settings.display_related_products %}