Use discounted price for JSON+LD structured data for product #2

Open
soulchild wants to merge 1 commits from discounted-price-structured-data into master
+10 -1
View File
@@ -746,8 +746,17 @@
endif endif
-%} -%}
<!-- yagi product structured data -->
{% liquid
assign original_product_price_format = product.selected_or_first_available_variant.price | money_without_currency
assign discounted_product_price = product.selected_or_first_available_variant.metafields.app--168074346497.auto_discounted_price.value | default: product.selected_or_first_available_variant.price
assign discounted_product_price_format = discounted_product_price | money_without_currency
assign search_original_string = '"price":"' | append: original_product_price_format | append: '"'
assign search_replace_string = '"price":"' | append: discounted_product_price_format | append: '"'
%}
<script type="application/ld+json"> <script type="application/ld+json">
{{ product | structured_data }} {{ product | structured_data | replace_first: search_original_string, search_replace_string }}
</script> </script>
</div> </div>
</product-component> </product-component>