Skip to content

Instantly share code, notes, and snippets.

View diegovelasquezweb's full-sized avatar

Diego Velasquez diegovelasquezweb

View GitHub Profile
@diegovelasquezweb
diegovelasquezweb / main-product.liquid
Created August 29, 2023 03:40
Add metafields to sections on PDP
{% comment %} hotspots carousel {% endcomment %}
{% assign hotspotsMetafield = product.metafields.custom.pl_hotspots_carousel.value %}
{% assign hotspotsContent = product.metafields.custom.pl_hotspots_content.value %}
{%- capture hotspots -%}
[
{%- for hotspot in hotspotsMetafield -%}
{
"x_coordinate": {{ hotspot.x_coordinate_hostpost.value | json }},
"y_coordinate": {{ hotspot.y_coordinate_hostpost.value | json }},
@diegovelasquezweb
diegovelasquezweb / _htmx-ext-shopify.md
Created August 12, 2023 01:38 — forked from fabianeichinger/_htmx-ext-shopify.md
htmx extension for Shopify Ajax API

htmx-ext-shopify gives you access to the Shopify Ajax API from HTML to progressively enhance your Liquid templates. It's an unofficial, experimental extension for htmx.

The extension manipulates API requests and responses in order to replace / update Liquid sections on the current page. The new HTML for sections comes from Bundled section rendering and inserted using htmx swapping and out of band swaps.

This behavior is controlled using existing and new (see below) hx-* attributes on the form triggering the request.

Current features

Update the customer's cart through the Shopify Ajax API and update the current page in response.

Installation