Ajustes antes de produccion

This commit is contained in:
2026-10-22 00:07:21 -06:00
parent f9666c4088
commit 1be9d16c83
124 changed files with 3540 additions and 772 deletions
+112
View File
@@ -0,0 +1,112 @@
{%- comment -%}
Product JSON-LD for Google rich results / merchant listings.
Adds aggregateRating (reviews.* metafields), shippingDetails and hasMerchantReturnPolicy
(theme settings › SEO) on top of the data Shopify's structured_data filter provides.
{%- endcomment -%}
{%- liquid
assign currency = cart.currency.iso_code
assign country = settings.sd_ship_country | default: 'MX' | upcase
assign ship_cost = settings.sd_ship_cost | default: 0
assign free_from = settings.sd_free_threshold | default: 0 | times: 100
assign product_url = request.origin | append: product.url
assign current = product.selected_or_first_available_variant
assign rating_count = product.metafields.reviews.rating_count.value | default: 0 | plus: 0
assign rating_value = product.metafields.reviews.rating.value.rating | default: 0
assign rating_best = product.metafields.reviews.rating.value.scale_max | default: 5
assign rating_worst = product.metafields.reviews.rating.value.scale_min | default: 1
assign brand = product.vendor | default: shop.name
-%}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"@id": {{ product_url | append: '#product' | json }},
"url": {{ product_url | json }},
"name": {{ product.title | json }},
"description": {{ product.description | strip_html | strip | truncate: 5000 | json }},
{%- if product.media.size > 0 %}
"image": [
{%- assign img_n = 0 -%}
{%- for media in product.media -%}
{%- if media.preview_image and img_n < 6 -%}
{%- if img_n > 0 %},{% endif -%}
{{ media.preview_image | image_url: width: 1920 | prepend: 'https:' | json }}
{%- assign img_n = img_n | plus: 1 -%}
{%- endif -%}
{%- endfor -%}
],
{%- endif %}
"brand": { "@type": "Brand", "name": {{ brand | json }} },
{%- if product.type != blank %}
"category": {{ product.type | json }},
{%- endif %}
{%- if current.sku != blank %}
"sku": {{ current.sku | json }},
{%- endif %}
{%- if rating_count > 0 and rating_value != 0 %}
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": {{ rating_value | json }},
"bestRating": {{ rating_best | json }},
"worstRating": {{ rating_worst | json }},
"ratingCount": {{ rating_count }},
"reviewCount": {{ rating_count }}
},
{%- endif %}
"offers": [
{%- for variant in product.variants -%}
{%- liquid
assign v_price = variant.price | divided_by: 100.0
assign v_rate = ship_cost
if free_from > 0 and variant.price >= free_from
assign v_rate = 0
endif
assign gtin_len = variant.barcode | size
-%}
{
"@type": "Offer",
"@id": {{ product_url | append: '?variant=' | append: variant.id | append: '#offer' | json }},
"url": {{ product_url | append: '?variant=' | append: variant.id | json }},
{%- if variant.sku != blank %}
"sku": {{ variant.sku | json }},
{%- endif %}
{%- if variant.barcode != blank and gtin_len >= 8 and gtin_len <= 14 %}
"gtin": {{ variant.barcode | json }},
{%- endif %}
{%- unless product.has_only_default_variant %}
"name": {{ product.title | append: ' - ' | append: variant.title | json }},
{%- endunless %}
"price": {{ v_price | round: 2 | json }},
"priceCurrency": {{ currency | json }},
"itemCondition": "https://schema.org/NewCondition",
"availability": "https://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}",
"seller": { "@type": "Organization", "name": {{ shop.name | json }} },
"shippingDetails": {
"@type": "OfferShippingDetails",
"shippingRate": { "@type": "MonetaryAmount", "value": {{ v_rate | json }}, "currency": {{ currency | json }} },
"shippingDestination": { "@type": "DefinedRegion", "addressCountry": {{ country | json }} },
"deliveryTime": {
"@type": "ShippingDeliveryTime",
"handlingTime": { "@type": "QuantitativeValue", "minValue": {{ settings.sd_handling_min | default: 1 }}, "maxValue": {{ settings.sd_handling_max | default: 2 }}, "unitCode": "DAY" },
"transitTime": { "@type": "QuantitativeValue", "minValue": {{ settings.sd_transit_min | default: 3 }}, "maxValue": {{ settings.sd_transit_max | default: 5 }}, "unitCode": "DAY" }
}
},
"hasMerchantReturnPolicy": {
"@type": "MerchantReturnPolicy",
"applicableCountry": {{ country | json }},
{%- if settings.sd_returns %}
"returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",
"merchantReturnDays": {{ settings.sd_return_days | default: 5 }},
"returnMethod": "https://schema.org/ReturnByMail",
"refundType": "https://schema.org/{{ settings.sd_refund_type | default: 'ExchangeRefund' }}",
"returnFees": "https://schema.org/{{ settings.sd_return_fees | default: 'FreeReturn' }}",
"merchantReturnLink": {{ request.origin | append: '/policies/refund-policy' | json }}
{%- else %}
"returnPolicyCategory": "https://schema.org/MerchantReturnNotPermitted"
{%- endif %}
}
}{% unless forloop.last %},{% endunless %}
{%- endfor %}
]
}
</script>