<h1 class="text-center mt-3"><?= global.web_title?> 購物車 </h1>
<thead>
<tr>
<th>圖片</th>
<th>商品</th>
<th class="text-end" style="width: 100px;">單價</th>
<th class="text-end" style="width: 100px;">數量</th>
<th class="text-end" style="width: 100px;">小計</th>
<th class="text-center" style="width: 80px;">刪除</th>
</tr>
</thead>
Object.values(cart).forEach(item => {
const subtotal = item.price * item.quantity;
total += subtotal;
cartItems.innerHTML += `
<tr>
<td><img src="${item.img}" alt="${item.title}" style="width: 50px;"></td>
<td>${item.title}</td>
<td class="text-end">${item.price}</td>
<td class="text-end">
<input type="number" class="form-control ms-auto text-end"
value="${item.quantity}" min="0"
onchange="updateQuantity('${item.sn}', this.value)">
</td>
<td class="text-end">${subtotal}</td>
<td class="text-center">
<button class="btn btn-sm text-danger" onclick="removeItem('${item.sn}')">
<i class="bi bi-trash"></i>
</button>
</td>
</tr>
`;
});