Adding POS availability to Product Page via Custom Liquid

Adding POS availability to Product Page via Custom Liquid

Sjoefke
Shopify Partner
1 0 0

Hi,

 

Can someone help me out? I tried to add the availability of my POS stores on the product page, but unfortunately something goes wrong. I added the following code:

 

{% assign availability_hilvarenbeek = product.metafields.custom.availability_hilvarenbeek %}
{% assign pos_availability = product.metafields.custom.pos_availability %}
{% assign show_availability_header = false %}

{% if availability_hilvarenbeek > 0 or pos_availability > 0 %}
{% assign show_availability_header = true %}
{% endif %}

{% if show_availability_header %}
<div style="background-color: #f0f0f0; border-radius: 10px; padding: 20px; margin: 20px 0;">
<div style="font-size: 12px; margin-top: 0px; padding-left: 18px;">
<b>Ook in de winkel:</b><br>
{% if availability_hilvarenbeek > 0 %}
⌂ Van Gool Hilvarenbeek: {{ availability_hilvarenbeek }}<br>
{% endif %}
{% if pos_availability > 0 %}
⌂ Padel Club Rotterdam: {{ pos_availability }}<br>
{% endif %}
</div>
{% endif %}

 

This works perfectly fine:

Sjoefke_0-1726734978906.png

I added the code via a custom liquid section:

Sjoefke_1-1726735013525.png

 

Unfortunately it also creates a lot of blank space underneath the product before the next section and I have no clue why this keeps happening:

 

Sjoefke_2-1726735208514.png

 

Someone who knows what I do wrong?

 

Thanks!

Replies 0 (0)