add video to out of stock products only

Highlighted
Shopify Partner
23 1 0

store URL = https://nostralux.co.uk/collections/pendants/products/edison-industrial-oculo-modern-pendant-light

i have some out of stock products in my store like the link above which will be back in few months. so my question is how can i add a video to specific products only which are out of stock. i don't want to add it on all products. i searched a lot but all of the help was related to add or embed a video to the product page and nothing is found to my question. 

0 Likes
Highlighted
Excursionist
80 19 19

Hi discky

Where exactly would you like to place the video?

And how are the products set as pre-order?

Presumably they're tagged somehow in Shopify Admin - either with normal tags or metafields?

You should be able to use the product object in the liquid template - https://shopify.dev/docs/themes/liquid/reference/objects/product - to work out whether or not it's pre-order - then render the video block to the page based on that.

0 Likes
Highlighted
Shopify Partner
23 1 0

if you see on the above link .. there is some trust icons below the add to cart button, i want to show/add/embed the video before those icons.  but only for this specific product. or other out of stock products. not the rest 

0 Likes
Highlighted
Excursionist
80 19 19

Hi discky

How are the products marked as Pre Order?

If it was the tag 'estimateend-70' which seems to be on that product - or I'm presuming it's just estimateend-[whatever number], and if the video was hosted let's say at YouTube.

You'd look for where the div with the class "checkout--icons-product" appears in your product template and just before that you'd do something like:

<!-- Create a preorder variable which is false by default -->
{% assign preorder = false %}
<!-- loop through the tags of this product -->
{% for tag in product.tags %}
	<!-- if the tag contains this estimateend- string... -->
	{% if tag contains "estimateend-" %}
		<!-- then change the preorder to true -->
		{% assign preorder = true %}
	{% endif %}
{% endfor %}
<!-- if preorder has become true it means the product has a tag that contains estimateend- so render the video embed code -->
{% if preorder %}
	<div class="preorder-video">
		<iframe src="https://www.youtube.com/embed/SPY9yZ0Mq84" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
	</div>
{% endif %}

 

I think something around that would be right.

Is it the same video every time? Or a different video per product?

0 Likes