We currently don't support unit prices with li-js-object, because it's not stored there. For now, you can just use li-object="product.selected_or_first_available_variant.unit_price | money". But if you want to switch the unit price when switching the variant, you would need to use the Section Rendering API
You're looping over the "child_link", so you would need to set it up like this: On the image wrapper you put a li-if="child_link.type == 'product_link'" and on the image li-object:src="child_link.object.featured_image | img_url: 'small'" and optionally li-object:alt="child_link.object.featured_image.alt"
Snippets don't store the settings data, that's done by the section. The snippet only stores the code, so it works a bit different than a Webflow component for example. In your case it would probably make most sense to use a metaobject for the faq and all other sections that have repetitive content.
We updated the search page because there were some old and false attributes. Can you compare the new template with you setup again? I saw for example, that the items have a li-for="product in collection.products", but it would need to be a li-for="product in search.results" on the search page. Same goes for pagination, filter, sort and the "no results" div. I would recommend to go over all the divs in that section and compare the attributes.
@Jan Can I build my own "unit price" with metafields and math, like li-js-price="product.price | divided_by: variant.metafields.custom.square_feet | money" ?
hi @Seth, li-js- elements are not liquid. Thats why you cant use liquid filters. But what you want to do is possible but more advanced. Metafields are not part of the product json, thats why we need to store it somehwere else.
First you need to loop over all variants: <div li-for="variants in products.variants">
<div li-js-if="selected_or_first_available_variant.id == {{ variant.id }}"</div>
<div li-object="variant.metafields.custom.square_feet" x-ref="variantDiv_{{ variant.id }}" x-effect="if ($refs['variantDiv_' + '{{ variant.id }}']) updateText($refs['variantDiv_' + '{{ variant.id }}'])">
</div>
</div>
</div>
and the you need to open a new alpine store on a element which wrapps the variant loop and the element whre you want to use your calculated unit price: <div class"wrapping-element" x-data="{ squareFeet: '{{ product.selected_or_first_available_variant.metafields.custom.squarefeet }}', updateText(ref) { this.variantTitle = ref.innerText;}}">
</div>
and now you can use the variable inside like you where tryning in the beginning: <div li-js-price="selected_or_first_available_variant.price / squareFeet"></div>
Compare at price and price are part of the the product json per default. Thats why you can access it very easy. But the unit price and also metafields are not
but acessing metafields cant be done like: product.selected_or_first_available_variant.... You need to create a new alpine variable like described above
And then add this alpine js attribute somewhere inside the product-variant-container: x-init="$watch('selected_product_id', value => renderSection(value, '{{ section.id }}'))" data-section-id="{{ section.id }}"
With that we fetch the section every time the variant changes. Now you can use li-object everywhere to display your metaobjects.
And then add this alpine js attribute somewhere inside the product-variant-container:x-init=\"$watch('selected_product_id', value => renderSection(value, '{{ section.id }}'))\" data-section-id=\"{{ section.id }}\"With that we fetch the section every time the variant changes. Now you can use li-object everywhere to display your metaobjects.https://shopify.dev/docs/api/ajax/section-rendering","dateCreated":"2024-10-22T21:21:35.485Z","dateModified":"2024-10-22T21:21:35.485Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/9198b265-c813-4ed7-89ba-4025d177dc62","name":"jonas.halbstark","identifier":"9198b265-c813-4ed7-89ba-4025d177dc62","image":"https://cdn.discordapp.com/avatars/947621552478904320/9741d807d28f33e26a3a3b01c121c60f.webp?size=256"},"commentCount":0,"comment":[],"position":31,"upvoteCount":0},{"@type":"Comment","text":"In the code you also find a swiper code to reinitialize the slider.. if you are not using it, you can delete it","dateCreated":"2024-10-22T21:32:28.438Z","dateModified":"2024-10-22T21:32:28.438Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/9198b265-c813-4ed7-89ba-4025d177dc62","name":"jonas.halbstark","identifier":"9198b265-c813-4ed7-89ba-4025d177dc62","image":"https://cdn.discordapp.com/avatars/947621552478904320/9741d807d28f33e26a3a3b01c121c60f.webp?size=256"},"commentCount":0,"comment":[],"position":32,"upvoteCount":0},{"@type":"Comment","text":"we are currenty working on implementing the section rendering api on an attribute basis","dateCreated":"2024-10-22T21:35:59.436Z","dateModified":"2024-10-22T21:35:59.436Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/9198b265-c813-4ed7-89ba-4025d177dc62","name":"jonas.halbstark","identifier":"9198b265-c813-4ed7-89ba-4025d177dc62","image":"https://cdn.discordapp.com/avatars/947621552478904320/9741d807d28f33e26a3a3b01c121c60f.webp?size=256"},"commentCount":0,"comment":[],"position":33,"upvoteCount":0},{"@type":"Comment","text":"Thanks!","dateCreated":"2024-10-22T21:49:18.967Z","dateModified":"2024-10-22T21:49:18.967Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/f25e946c-995b-4c30-8720-e3cbc65b0a98","name":"Seth","identifier":"f25e946c-995b-4c30-8720-e3cbc65b0a98","image":"https://cdn.discordapp.com/avatars/416277958999801868/cf776d2a60aa01b1b0d5bae4d8774325.webp?size=256"},"commentCount":0,"comment":[],"position":34,"upvoteCount":0}],"author":{"@type":"Person","url":"https://liquify.hall.community/members/f25e946c-995b-4c30-8720-e3cbc65b0a98","name":"Seth","identifier":"f25e946c-995b-4c30-8720-e3cbc65b0a98","image":"https://cdn.discordapp.com/avatars/416277958999801868/cf776d2a60aa01b1b0d5bae4d8774325.webp?size=256"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0}}]