Skip to content

Commit 294f810

Browse files
committed
Fixed price formatting and decoding
1 parent 123f4eb commit 294f810

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/fetchStock.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,13 @@ export function updateStockStatus(products) {
130130

131131
// Update other cells
132132
if (priceCell && product.productPrice) {
133-
priceCell.textContent = product.productPrice;
133+
// Create a temporary element to decode HTML entities
134+
const tempElement = document.createElement('div');
135+
tempElement.innerHTML = product.productPrice;
136+
// Set the decoded text content
137+
priceCell.textContent = tempElement.textContent;
134138
priceCell.style.color = "";
139+
tempElement.remove();
135140
}
136141
if (linkCell && product.internalLink) {
137142
linkCell.innerHTML = `<a href="${product.internalLink}" target="_blank" rel="noopener noreferrer">View<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="currentColor" d="M5 17.59L15.59 7H9V5h10v10h-2V8.41L6.41 19z"/></svg></a>`;

0 commit comments

Comments
 (0)