Add Comments link below download button on mobile

Shows "Comments (N)" anchor link below the purchase/download well,
visible only on mobile where comments section is further down the page.
SPA navigation updates the count dynamically.
This commit is contained in:
russell@unturf.com 2026-02-12 07:32:14 -05:00
parent 0299f85fc9
commit 47fb7a5440
3 changed files with 14 additions and 2 deletions

View file

@ -1451,7 +1451,8 @@ textarea.markup-editor-textarea {
}
/* Show the comments anchor link on mobile */
.related-content-comments-link {
.related-content-comments-link,
.product-comments-link {
display: block;
text-align: center;
padding: 10px;
@ -2901,7 +2902,8 @@ textarea {
.related-content-row-prev {
opacity: 0.55;
}
.related-content-comments-link {
.related-content-comments-link,
.product-comments-link {
display: none;
}

View file

@ -733,6 +733,12 @@
updateRelated(data.related, data.comments_enabled, data.comment_count);
// Update the product-level comments link
var pcLink = document.querySelector('.product-comments-link');
if (pcLink && data.comments_enabled) {
pcLink.textContent = 'Comments (' + (data.comment_count || 0) + ')';
}
if (data.canonical_url) {
history.pushState({productId: data.product_id}, data.title, data.canonical_url);
}

View file

@ -244,6 +244,10 @@
{% endif %}
</div>
{% if shop.comments_enabled %}
<a href="#comments" class="product-comments-link">Comments ({{ product.public_comment_count }})</a>
{% endif %}
{% if price_history | length > 1 %}
<details class="price-history-details">
<summary>Price History ({{ price_history | length }})</summary>