I am looking to copy the Product page section to the home page on the Impulse theme. So on the home page I would like there to be a section where the user is able to buy a product the same way if the user was on the actual product page buying the product. So all that is in the product page section, I would like to have copied to the home page as a sort of call to action feature. What are the steps that I need to do in order to get it working?
Hello mate,
yes you can do this in these steps.
1-create a new section with a unique section name.
2-copy the code of the product page’s section.
3-and paste it to the newly created section
4- scroll to very bottom of code and add this preset code
{% schema %}
{
"name": "section name",
"settings": [
{
"id": "badge_row",
"type": "checkbox",
"label": "Show?",
"default": true
}
],
"presets":
[
{
"name": "section name",
"category": "custom"
}
]
}
{% endschema %}
5-save it. you are all done. now you can use this section in you home pae from Shopify theme customization
Ok, so I copied the code from my product page to the new section page that I created. For clarification do I have to remove the schema from my product page’s code and replace it with the one you gave me? By doing that I was able to see the new section in my theme sections, but when I tried to add the new section to my home page, I got this error on the website: Liquid error (product-form line 2): product form must be given a product
I also tried adding the schema you gave to below the already existing schema, but then I got this error in my Shopify code editor:
This file contains the following errors:
- Line 168 — Liquid syntax error: Duplicate entries for tag: schema
Below is the original Product page code. What changes would I need to edit on this code? Thanks!
{%- liquid
assign isModal = false
if template == 'product.modal'
assign isModal = true
endif
-%}
{%- render 'product-template',
product: product,
description_style: section.settings.description_style,
image_position: section.settings.image_position,
image_container_width: section.settings.image_size,
section_id: product.id,
social: section.settings.social_enable,
isModal: isModal,
thumbnail_position: section.settings.thumbnail_position,
thumbnail_arrows: section.settings.thumbnail_arrows,
mobile_layout: section.settings.mobile_layout,
video_looping: section.settings.enable_video_looping,
video_style: section.settings.product_video_style
-%}
{%- if settings.enable_product_reviews and settings.reviews_layout == 'full' -%}
---
{{ product.metafields.spr.reviews }}
{%- endif -%}
{% schema %}
{
"name": "Product pages",
"settings": [
{
"type": "select",
"id": "description_style",
"label": "Description position",
"default": "default",
"options": [
{
"value": "default",
"label": "Next to media"
},
{
"value": "full",
"label": "Below media"
}
]
},
{
"type": "checkbox",
"id": "social_enable",
"label": "Enable social sharing",
"default": true
},
{
"type": "header",
"content": "Media"
},
{
"type": "paragraph",
"content": "Learn more about [media types](https://help.shopify.com/en/manual/products/product-media)"
},
{
"type": "select",
"id": "image_position",
"label": "Position",
"default": "left",
"options": [
{
"value": "left",
"label": "Left"
},
{
"value": "right",
"label": "Right"
}
]
},
{
"type": "select",
"id": "image_size",
"label": "Size",
"default": "medium",
"options": [
{
"value": "small",
"label": "Small"
},
{
"value": "medium",
"label": "Medium"
},
{
"value": "large",
"label": "Large"
}
]
},
{
"type": "select",
"id": "thumbnail_position",
"label": "Thumbnail position",
"default": "beside",
"options": [
{
"value": "beside",
"label": "Next to media"
},
{
"value": "below",
"label": "Below media"
}
]
},
{
"type": "checkbox",
"id": "thumbnail_arrows",
"label": "Show thumbnail arrows"
},
{
"type": "select",
"id": "mobile_layout",
"label": "Mobile layout",
"default": "partial",
"options": [
{
"value": "partial",
"label": "75% width"
},
{
"value": "full",
"label": "Full width"
}
]
},
{
"type": "checkbox",
"id": "enable_video_looping",
"label": "Enable video looping",
"default": true
},
{
"type": "select",
"id": "product_video_style",
"label": "Video style",
"default": "muted",
"options": [
{
"value": "muted",
"label": "Video without sound"
},
{
"value": "unmuted",
"label": "Video with sound"
}
],
"info": "Video with sound will not autoplay"
}
]
}
{% endschema %}
Not all product page just copy specific section code which you want to add in homepage