-
-
Save panzerdp/aa16a8d237c96146a728b0250d97ab46 to your computer and use it in GitHub Desktop.
ISBNExpress Shopify app: display the book details in a list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign authors = product.metafields["app-ibp-book"].authors %} | |
{% if authors %} | |
<b>Author(s):</b> {{ authors | metafield_text }} | |
<br/> | |
{% endif %} | |
{% assign publicationYear = product.metafields["app-ibp-book"].publication_year.value %} | |
{% if publicationYear %} | |
<b>Publication year:</b> {{ publicationYear }} | |
<br/> | |
{% endif %} | |
{% assign publicationDate = product.metafields["app-ibp-book"].publication_date.value %} | |
{% if publicationDate %} | |
<b>Publication date:</b> {{ publicationDate }} | |
<br/> | |
{% endif %} | |
{% assign pages = product.metafields["app-ibp-book"].pages.value %} | |
{% if pages %} | |
<b>Pages:</b> {{ pages }} | |
<br/> | |
{% endif %} | |
{% assign binding = product.metafields["app-ibp-book"].binding.value %} | |
{% if binding %} | |
<b>Binding:</b> {{ binding }} | |
<br/> | |
{% endif %} | |
{% assign language = product.metafields["app-ibp-book"].language %} | |
{% if language == 'de' %} | |
<b>Language:</b> German <br/> | |
{% elsif language == 'en' %} | |
<b>Language:</b> English <br/> | |
{% elsif language == 'fr' %} | |
<b>Language:</b> French <br/> | |
{% elsif language == 'es' %} | |
<b>Language:</b> Spanish <br/> | |
{% endif %} | |
{% assign publisher = product.metafields["app-ibp-book"].publisher %} | |
{% if publisher %} | |
<b>Publisher:</b> {{ publisher }} | |
<br/> | |
{% endif %} | |
{% assign condition = product.metafields["app-ibp-book"].condition %} | |
{% if condition %} | |
<b>Condition:</b> {{ condition }} | |
<br/> | |
{% endif %} | |
{% for variant in product.variants %} | |
{% if variant.barcode != '' %} | |
<b>ISBN:</b> {{ variant.barcode }} | |
<br/> | |
{% break %} | |
{% endif %} | |
{% endfor %} | |
{% assign dimValue = product.metafields["app-ibp-book"].dimensions.value %} | |
{% if dimValue %} | |
<b>Dimensions:</b> {{ dimValue[0].value }} x {{ dimValue[1].value }} x {{ dimValue[2].value }} {{ dimValue[0].unit }} | |
<br/> | |
{% endif %} | |
{% for variant in product.variants %} | |
{% if variant.weight_in_unit != 0 %} | |
<b>Weight:</b> {{ variant.weight_in_unit }} {{ variant.weight_unit }} | |
{% break %} | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1. What it does
The above liquid code displays the book details using metafields.
2. How to add the code to theme's product page
Go to Shopify Admin > Online Store -> Customise -> Select any product -> Click Add block -> Select Custom liquid.