Produccion 1

This commit is contained in:
2026-10-02 19:32:54 -06:00
parent 7ed1889bfb
commit 220178d421
81 changed files with 2993 additions and 531 deletions
+650 -162
View File
@@ -165,22 +165,63 @@
{% endif %}
</div>
{% if product.images.size > 1 %}
<div class="product__thumbs">
{% assign gallery_count = 0 %}
{% if main_image != blank %}
{% assign gallery_count = 1 %}
{% endif %}
{% for image in product.images %}
{% if image.id != main_image.id %}
{% assign gallery_count = gallery_count | plus: 1 %}
{% endif %}
{% endfor %}
<div class="product__thumbs" data-product-thumbs>
{% if main_image != blank %}
<div class="product__thumb product__thumb--main">
{{
main_image
| image_url: width: 1400
| image_tag:
alt: main_alt,
loading: 'eager',
fetchpriority: 'high',
widths: '700, 1000, 1400',
sizes: '100vw',
draggable: false
}}
</div>
{% endif %}
{% for image in product.images %}
{% if image.id != main_image.id %}
{% assign thumb_alt = image.alt | default: product.title %}
{{
image
| image_url: width: 900
| image_tag:
alt: thumb_alt,
loading: 'lazy',
widths: '400, 700, 900',
sizes: '(min-width: 1120px) 28vw, 50vw'
}}
<div class="product__thumb">
{{
image
| image_url: width: 900
| image_tag:
alt: thumb_alt,
loading: 'lazy',
widths: '400, 700, 900',
sizes: '(max-width: 767px) 100vw, (min-width: 1120px) 28vw, 50vw',
draggable: false
}}
</div>
{% endif %}
{% endfor %}
</div>
{% if gallery_count > 1 %}
<div
class="product__gallery-progress"
data-gallery-progress
style="--slides: {{ gallery_count }}"
role="progressbar"
aria-valuemin="1"
aria-valuemax="{{ gallery_count }}"
aria-valuenow="1"
aria-label="{{ 'product_page.gallery' | t }}"
>
<span></span>
</div>
{% endif %}
{% endif %}
</div>
@@ -428,7 +469,10 @@
}}
<span class="product__compare-label product__compare-label--after">{{ 'product_page.after' | t }}</span>
</div>
<img class="product__compare-mark" src="{{ 'logo-seasons.svg' | asset_url }}" alt="" width="280" height="80">
<img class="product__compare-mark" src="{{ 'logo-seasons.svg' | asset_url }}" alt="" width="280" height="80"
loading="lazy"
decoding="async"
>
</section>
{% endif %}
@@ -458,90 +502,87 @@
</section>
{% if show_reviews %}
<section class="product__reviews" id="product-reviews">
<h2 class="product__block-title">{{ 'product_page.reviews' | t }}</h2>
{% if rating_count > 0 %}
<div class="product__summary">
<div>
<p class="product__score">{{ 'product_page.rating_of' | t: rating: rating_value }}</p>
<p class="product__based">{{ 'product_page.based_on' | t: count: rating_count }}</p>
</div>
<span class="product__stars" aria-hidden="true">
{% for star in (1..5) %}
<svg class="product__star{% if star > rating_value %} is-off{% endif %}" width="18" height="18" viewBox="0 0 14 14" focusable="false">
<path d="M7 1.2l1.45 3.22 3.5.4-2.62 2.38.74 3.46L7 8.95 3.93 10.66l.74-3.46L2.05 4.82l3.5-.4L7 1.2z" fill="currentColor"/>
</svg>
{% endfor %}
</span>
</div>
{% assign rating_exact = product.metafields.reviews.rating.value.rating | default: rating_value | round: 2 %}
{% assign rating_text = rating_exact | append: '' %}
{% unless rating_text contains '.' %}
{% assign rating_text = rating_text | append: '.00' %}
{% else %}
{% assign rating_decimals = rating_text | split: '.' | last %}
{% if rating_decimals.size == 1 %}
{% assign rating_text = rating_text | append: '0' %}
{% endif %}
{% endunless %}
<section
class="product__reviews"
id="product-reviews"
data-product-reviews
data-product-id="{{ product.id }}"
data-product-handle="{{ product.handle | escape }}"
data-shop="{{ shop.permanent_domain | escape }}"
data-reviews-shop="{{ section.settings.reviews_shop | escape }}"
data-reviews-storefront="{{ section.settings.reviews_storefront | escape }}"
>
<div class="product__reviews-head">
<h2 class="product__reviews-title">{{ 'product_page.reviews' | t }}</h2>
<div class="product__reviews-bar">
{% if rating_count > 0 %}
<div class="product__summary">
<div class="product__summary-score">
<span class="product__stars" aria-hidden="true">
{% for star in (1..5) %}
<svg class="product__star{% if star > rating_value %} is-off{% endif %}" width="16" height="16" viewBox="0 0 14 14" focusable="false">
<path d="M7 1.2l1.45 3.22 3.5.4-2.62 2.38.74 3.46L7 8.95 3.93 10.66l.74-3.46L2.05 4.82l3.5-.4L7 1.2z" fill="currentColor"/>
</svg>
{% endfor %}
</span>
<p class="product__score">{{ 'product_page.rating_of' | t: rating: rating_text }}</p>
</div>
<p class="product__based">{{ 'product_page.based_on' | t: count: rating_count }}</p>
</div>
<span class="product__reviews-rule" aria-hidden="true"></span>
{% endif %}
<button
class="product__write"
type="button"
data-write-review
aria-expanded="false"
aria-controls="product-review-form"
>
{{ 'product_page.write_review' | t }}
</button>
</div>
</div>
{% if review_items != blank %}
<div data-review-list>
{% for review in review_items %}
{% liquid
assign review_field = review.texto | default: review.text | default: review.comentario | default: review.resena
assign review_author = review.autor.value | default: review.autor | default: review.author.value | default: review.nombre.value | default: review.name.value
assign review_stars = review.calificacion.value | default: review.rating.value | default: 5 | round
assign review_photo = review.foto.value | default: review.image.value | default: review.avatar.value
assign review_image = blank
if review_photo.preview_image != blank
assign review_image = review_photo.preview_image
elsif review_photo.width != blank
assign review_image = review_photo
endif
if review_author == blank
assign review_author = 'product_page.reviewer' | t
endif
assign review_initial = review_author | slice: 0, 1 | upcase
assign review_plain = ''
if review.id == blank
assign review_plain = review | strip
endif
%}
{% if review_field != blank or review_plain != blank %}
<article class="product__review" data-review {% if forloop.index > 3 %}hidden{% endif %}>
{% if review_image %}
{{ review_image | image_url: width: 120 | image_tag: class: 'product__avatar', alt: review_author, loading: 'lazy' }}
{% else %}
<span class="product__avatar" aria-hidden="true">{{ review_initial | escape }}</span>
{% endif %}
<div>
<p class="product__review-name">{{ review_author | escape }}</p>
<span class="product__stars" aria-hidden="true">
{% for star in (1..5) %}
<svg class="product__star{% if star > review_stars %} is-off{% endif %}" width="14" height="14" viewBox="0 0 14 14" focusable="false">
<path d="M7 1.2l1.45 3.22 3.5.4-2.62 2.38.74 3.46L7 8.95 3.93 10.66l.74-3.46L2.05 4.82l3.5-.4L7 1.2z" fill="currentColor"/>
</svg>
{% endfor %}
</span>
<div class="product__review-text">
{% if review_field != blank %}
{{ review_field | metafield_tag }}
{% else %}
{{ review_plain | escape | newline_to_br }}
{% endif %}
</div>
</div>
</article>
{% endif %}
<form
id="product-review-form"
class="product__write-form"
data-sent="{{ 'product_page.review_sent' | t | escape }}"
data-error="{{ 'product_page.review_error' | t | escape }}"
>
<p class="product__write-success" role="status" hidden></p>
<p class="product__write-error" role="alert" hidden></p>
<label class="product__write-label" for="ReviewName">{{ 'product_page.review_name' | t }}</label>
<input id="ReviewName" class="product__write-input" type="text" name="reviewer_name" autocomplete="name" required>
<label class="product__write-label" for="ReviewEmail">{{ 'product_page.review_email' | t }}</label>
<input id="ReviewEmail" class="product__write-input" type="email" name="reviewer_email" autocomplete="email" required>
<fieldset class="product__write-stars">
<legend class="product__write-label">{{ 'product_page.review_rating' | t }}</legend>
{% for star in (1..5) %}
<label>
<input type="radio" name="score" value="{{ star }}" {% if star == 5 %}checked{% endif %}>
<span>{{ star }}</span>
</label>
{% endfor %}
</div>
{% if review_count > 3 %}
<nav class="product__pager" data-review-pager aria-label="{{ 'product_page.reviews_label' | t }}">
{% for page_number in (1..review_pages) %}
<button type="button" data-review-page="{{ forloop.index0 }}" {% if forloop.first %}class="is-current"{% endif %} aria-label="{{ 'collection_page.page' | t: page: forloop.index }}">
{{ forloop.index }}
</button>
{% endfor %}
<button type="button" data-review-next aria-label="{{ 'collection_page.next_page' | t }}">
<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true" focusable="false">
<path d="M5 2.5l4.5 4.5L5 11.5" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
</nav>
{% endif %}
{% endif %}
</fieldset>
<label class="product__write-label" for="ReviewBody">{{ 'product_page.review_body' | t }}</label>
<textarea id="ReviewBody" class="product__write-input" name="review_body" rows="4" required></textarea>
<button class="product__write" type="submit">{{ 'product_page.review_submit' | t }}</button>
</form>
<div class="product__review-list" data-review-list></div>
<button class="product__more" type="button" data-review-more hidden>
{{ 'product_page.view_more' | t }}
</button>
</section>
{% endif %}
</article>
@@ -594,6 +635,20 @@
gap: 10px;
}
.product__thumb {
min-width: 0;
}
.product__thumb--main,
.product__gallery-progress {
display: none;
}
.product__thumbs img {
-webkit-user-drag: none;
user-select: none;
}
.product__badges {
display: flex;
flex-wrap: wrap;
@@ -780,7 +835,7 @@
.product__add,
.product__buy,
.product__favorite,
.product__pager button {
.product__more {
font-family: inherit;
}
@@ -999,11 +1054,138 @@
pointer-events: none;
}
.product__also,
.product__reviews {
.product__also {
margin-top: 72px;
}
.product:has(.product__reviews) {
padding-bottom: 0;
}
.product__reviews {
margin: 72px -50px 0;
padding: 100px 100px 80px;
background: linear-gradient(180deg, #f9f9fa 0%, #e8fff9 100%);
}
.product__reviews-head {
display: flex;
flex-direction: column;
margin-bottom: 8px;
}
.product__reviews-title {
margin: 0 0 60px;
font-size: 30px;
font-weight: 500;
line-height: 1.2;
text-transform: uppercase;
}
.product__reviews-bar {
display: flex;
align-items: center;
justify-content: center;
gap: 100px;
}
.product__reviews-head .product__summary {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 10px;
margin: 0;
}
.product__summary-score {
display: flex;
align-items: center;
gap: 8px;
}
.product__reviews .product__stars {
gap: 1px;
}
.product__reviews-head .product__score,
.product__reviews-head .product__based {
margin: 0;
color: #111;
font-size: 16px;
font-weight: 300;
}
.product__reviews-rule {
flex: none;
width: 1px;
height: 70px;
background: #d9d9d9;
}
.product__write {
flex: none;
width: 326px;
height: 50px;
padding: 0 28px;
border: 0;
border-radius: 60px;
background: #9dd6c7;
color: #111;
font: inherit;
font-size: 16px;
font-weight: 300;
cursor: pointer;
}
.product__write-form {
display: none;
max-width: 640px;
margin: 20px 0 8px;
gap: 8px;
}
.product__write-form.is-open {
display: grid;
}
.product__write-label {
margin-top: 8px;
font-size: 14px;
font-weight: 500;
}
.product__write-input {
width: 100%;
box-sizing: border-box;
padding: 12px 14px;
border: 1px solid #e5e5e5;
border-radius: 10px;
font: inherit;
font-weight: 300;
}
.product__write-stars {
display: flex;
gap: 8px;
margin: 0;
padding: 0;
border: 0;
}
.product__write-stars label {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 14px;
font-weight: 300;
}
.product__write-success {
margin: 0;
font-size: 16px;
font-weight: 300;
}
.product__score {
margin: 0;
font-size: 28px;
@@ -1016,68 +1198,68 @@
margin-bottom: 8px;
}
.product__review-list {
margin: 40px 140px 0;
}
.product__review {
display: grid;
grid-template-columns: 56px minmax(0, 1fr);
gap: 16px;
padding: 20px 0;
border-top: 1px solid #ececec;
display: flex;
flex-direction: column;
gap: 10px;
padding: 20px 50px;
border-top: 1px solid #e6e6e6;
}
.product__review:last-child {
border-bottom: 1px solid #e6e6e6;
}
.product__review-person {
display: flex;
align-items: center;
gap: 10px;
}
.product__avatar {
display: grid;
width: 56px;
width: 55px;
height: 56px;
place-items: center;
overflow: hidden;
border-radius: 50%;
background: #f3f3f3;
font-weight: 600;
}
img.product__avatar {
display: block;
object-fit: cover;
border: 1px solid #ececec;
border-radius: 10px;
background: #fff;
color: #111;
}
.product__review-name {
margin: 0 0 6px;
margin: 0;
font-size: 16px;
font-weight: 600;
font-weight: 300;
}
.product__review-text {
margin-top: 8px;
font-size: 15px;
margin: 0;
font-size: 16px;
font-weight: 300;
line-height: 1.5;
line-height: 22px;
}
.product__pager {
display: flex;
justify-content: center;
gap: 8px;
margin-top: 28px;
}
.product__pager button {
display: grid;
width: 40px;
height: 40px;
place-items: center;
.product__more {
display: block;
margin: 28px auto 0;
padding: 6px 10px;
border: 0;
border-radius: 50%;
background: transparent;
color: #111;
font-size: 16px;
font-weight: 500;
line-height: 1;
cursor: pointer;
}
.product__pager button.is-current {
background: #111;
color: #fff;
}
.product__pager [data-review-next] {
background: #c9c9c9;
.product__more:disabled {
opacity: 0.5;
cursor: default;
}
.product [hidden] {
@@ -1102,6 +1284,23 @@
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.product__reviews {
margin-left: -20px;
margin-right: -20px;
padding-left: 40px;
padding-right: 40px;
}
.product__review-list {
margin-left: 0;
margin-right: 0;
}
.product__review {
padding-left: 0;
padding-right: 0;
}
.product__compare {
height: 360px;
}
@@ -1112,6 +1311,60 @@
padding: 12px 16px 56px;
}
.product__gallery {
gap: 16px;
}
.product__thumbs {
display: flex;
gap: 0;
overflow-x: auto;
overscroll-behavior-x: contain;
scroll-snap-type: x mandatory;
scrollbar-width: none;
cursor: grab;
-webkit-overflow-scrolling: touch;
}
.product__thumbs::-webkit-scrollbar {
display: none;
}
.product__thumbs.is-dragging {
cursor: grabbing;
scroll-snap-type: none;
}
.product__gallery:has(.product__thumbs) .product__main {
display: none;
}
.product__thumb {
flex: 0 0 100%;
scroll-snap-align: start;
}
.product__thumb--main {
display: block;
}
.product__gallery-progress {
display: block;
position: relative;
height: 2px;
background: #d9d9d9;
}
.product__gallery-progress span {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: calc(100% / var(--slides));
background: #111;
transform: translateX(0);
}
.product__title {
font-size: 26px;
}
@@ -1142,11 +1395,58 @@
display: none;
}
.product__also,
.product__reviews {
.product__also {
margin-top: 40px;
}
.product__reviews {
margin: 40px -16px 0;
padding: 50px 15px 48px;
}
.product__reviews-title {
margin-bottom: 20px;
font-size: 20px;
}
.product__reviews-bar {
flex-direction: column;
align-items: stretch;
gap: 20px;
}
.product__reviews-rule {
display: none;
}
.product__write {
width: 100%;
height: 35px;
font-size: 12px;
font-weight: 500;
}
.product__review-list {
margin: 30px 0 0;
}
.product__review {
padding: 20px 0;
}
.product__avatar {
width: 45px;
height: 45px;
}
.product__review-name {
font-size: 15px;
}
.product__more {
font-size: 15px;
}
.product__summary {
align-items: flex-start;
flex-direction: column;
@@ -1192,6 +1492,50 @@
applyWish();
const thumbs = root.querySelector('[data-product-thumbs]');
if (thumbs) {
let pointerId = null;
let startX = 0;
let startScroll = 0;
thumbs.addEventListener('pointerdown', (event) => {
if (event.pointerType !== 'mouse' || event.button !== 0) return;
pointerId = event.pointerId;
startX = event.clientX;
startScroll = thumbs.scrollLeft;
thumbs.classList.add('is-dragging');
thumbs.setPointerCapture(pointerId);
});
thumbs.addEventListener('pointermove', (event) => {
if (event.pointerId !== pointerId) return;
thumbs.scrollLeft = startScroll - (event.clientX - startX);
});
const endDrag = (event) => {
if (event.pointerId !== pointerId) return;
pointerId = null;
thumbs.classList.remove('is-dragging');
};
thumbs.addEventListener('pointerup', endDrag);
thumbs.addEventListener('pointercancel', endDrag);
thumbs.addEventListener('dragstart', (event) => event.preventDefault());
const progress = root.querySelector('[data-gallery-progress]');
const mark = progress ? progress.querySelector('span') : null;
const syncProgress = () => {
if (!mark || !thumbs.clientWidth) return;
const slides = thumbs.children.length;
const index = Math.max(0, Math.min(slides - 1, Math.round(thumbs.scrollLeft / thumbs.clientWidth)));
mark.style.transform = 'translateX(' + (index * 100) + '%)';
if (progress) progress.setAttribute('aria-valuenow', String(index + 1));
};
thumbs.addEventListener('scroll', syncProgress, { passive: true });
window.addEventListener('resize', syncProgress);
syncProgress();
}
const form = root.querySelector('.product__form');
const qtyInput = root.querySelector('[data-qty-input]');
@@ -1343,33 +1687,163 @@
}
})();
const reviewNodes = [...root.querySelectorAll('[data-review]')];
const pager = root.querySelector('[data-review-pager]');
if (reviewNodes.length && pager) {
const pageSize = 3;
const pageButtons = [...pager.querySelectorAll('[data-review-page]')];
const showPage = (page) => {
const maxPage = Math.max(0, pageButtons.length - 1);
const nextPage = Math.min(Math.max(0, page), maxPage);
reviewNodes.forEach((node, index) => {
const visible = index >= nextPage * pageSize && index < (nextPage + 1) * pageSize;
node.hidden = !visible;
});
pageButtons.forEach((button) => {
button.classList.toggle('is-current', Number(button.dataset.reviewPage) === nextPage);
});
pager.dataset.page = String(nextPage);
const reviewsRoot = root.querySelector('[data-product-reviews]');
if (reviewsRoot) {
const list = reviewsRoot.querySelector('[data-review-list]');
const more = reviewsRoot.querySelector('[data-review-more]');
const writeButton = reviewsRoot.querySelector('[data-write-review]');
const writeForm = reviewsRoot.querySelector('#product-review-form');
const cache = new Map();
let productExternalId = reviewsRoot.dataset.productId;
let currentPage = 1;
let loading = false;
const reviewsShop = reviewsRoot.dataset.reviewsShop || reviewsRoot.dataset.shop;
const starPath = 'M7 1.2l1.45 3.22 3.5.4-2.62 2.38.74 3.46L7 8.95 3.93 10.66l.74-3.46L2.05 4.82l3.5-.4L7 1.2z';
const plainText = (html) => {
const parsed = new DOMParser().parseFromString(html || '', 'text/html');
return (parsed.body.textContent || '').trim();
};
pager.addEventListener('click', (event) => {
const pageButton = event.target.closest('[data-review-page]');
if (pageButton) {
showPage(Number(pageButton.dataset.reviewPage));
return;
const renderReviews = (reviews, append) => {
if (!append) list.replaceChildren();
reviews.forEach((review) => {
const rating = Math.max(1, Math.min(5, Math.round(Number(review.rating) || 0)));
const article = document.createElement('article');
article.className = 'product__review';
article.dataset.review = '';
const stars = document.createElement('span');
stars.className = 'product__stars';
stars.setAttribute('aria-label', rating + ' de 5');
for (let star = 1; star <= 5; star += 1) {
const icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
icon.setAttribute('class', 'product__star' + (star > rating ? ' is-off' : ''));
icon.setAttribute('width', '16');
icon.setAttribute('height', '16');
icon.setAttribute('viewBox', '0 0 14 14');
icon.setAttribute('aria-hidden', 'true');
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
path.setAttribute('d', starPath);
path.setAttribute('fill', 'currentColor');
icon.append(path);
stars.append(icon);
}
const person = document.createElement('div');
person.className = 'product__review-person';
const avatar = document.createElement('span');
avatar.className = 'product__avatar';
avatar.setAttribute('aria-hidden', 'true');
avatar.innerHTML = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="8" r="3.25" stroke="currentColor" stroke-width="1.4"/><path d="M5.2 19.4c1.15-3.15 3.35-4.7 6.8-4.7s5.65 1.55 6.8 4.7" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>';
const name = document.createElement('p');
name.className = 'product__review-name';
name.textContent = review.reviewer_name || 'Cliente';
person.append(avatar, name);
const text = document.createElement('p');
text.className = 'product__review-text';
const body = plainText(review.body_html);
text.textContent = body || review.title || '';
article.append(stars, person, text);
list.append(article);
});
};
const updateMore = (page, total) => {
currentPage = page;
if (!more) return;
more.hidden = page >= total;
};
const loadPage = async (page, append) => {
if (loading || !productExternalId || !reviewsShop) return;
loading = true;
if (more) more.disabled = true;
try {
if (!cache.has(page)) {
const url = new URL('https://judge.me/reviews/reviews_for_widget');
url.searchParams.set('url', reviewsShop);
url.searchParams.set('shop_domain', reviewsShop);
url.searchParams.set('platform', 'shopify');
url.searchParams.set('page', String(page));
url.searchParams.set('per_page', '3');
url.searchParams.set('product_id', String(productExternalId));
const response = await fetch(url);
if (!response.ok) return;
cache.set(page, await response.json());
}
const data = cache.get(page);
renderReviews(data.reviews || [], append);
updateMore(page, data.pagination ? data.pagination.total_pages : 1);
} finally {
loading = false;
if (more) more.disabled = false;
}
if (event.target.closest('[data-review-next]')) {
showPage(Number(pager.dataset.page || 0) + 1);
}
});
};
const resolveProduct = async () => {
if (!reviewsShop || reviewsShop === reviewsRoot.dataset.shop) return;
const storefront = (reviewsRoot.dataset.reviewsStorefront || '').replace(/\/$/, '');
const handle = reviewsRoot.dataset.productHandle;
if (!storefront || !handle) return;
const response = await fetch(storefront + '/products/' + handle + '.js');
if (!response.ok) return;
const product = await response.json();
if (product && product.id) productExternalId = String(product.id);
};
if (more) {
more.addEventListener('click', () => {
loadPage(currentPage + 1, true);
});
}
resolveProduct().then(() => loadPage(1, false)).catch(() => {});
if (writeButton && writeForm) {
const openForm = (open) => {
writeForm.classList.toggle('is-open', open);
writeButton.setAttribute('aria-expanded', open ? 'true' : 'false');
};
writeButton.addEventListener('click', () => {
openForm(!writeForm.classList.contains('is-open'));
});
writeForm.addEventListener('submit', async (event) => {
event.preventDefault();
const success = writeForm.querySelector('.product__write-success');
const error = writeForm.querySelector('.product__write-error');
if (success) success.hidden = true;
if (error) error.hidden = true;
const payload = new URLSearchParams();
payload.set('shop_domain', reviewsShop);
payload.set('platform', 'shopify');
payload.set('id', String(productExternalId || ''));
payload.set('name', writeForm.reviewer_name.value);
payload.set('email', writeForm.reviewer_email.value);
payload.set('rating', (writeForm.querySelector('input[name="score"]:checked') || {}).value || '5');
payload.set('body', writeForm.review_body.value);
try {
const response = await fetch('https://api.judge.me/api/v1/reviews', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: payload,
});
if (!response.ok) throw new Error('review');
if (success) {
success.hidden = false;
success.textContent = writeForm.dataset.sent || '';
}
writeForm.reset();
} catch (submitError) {
if (error) {
error.hidden = false;
error.textContent = writeForm.dataset.error || '';
}
}
});
}
}
})();
{% endjavascript %}
@@ -1381,6 +1855,20 @@
{
"type": "paragraph",
"content": "t:product_page.metafields"
},
{
"type": "text",
"id": "reviews_shop",
"label": "t:product_page.reviews_shop",
"info": "t:product_page.reviews_shop_info",
"default": "seasons-world.myshopify.com"
},
{
"type": "text",
"id": "reviews_storefront",
"label": "t:product_page.reviews_storefront",
"info": "t:product_page.reviews_storefront_info",
"default": "https://www.seasonsmexico.com"
}
],
"disabled_on": {