Dynamic text: or pay in X installments of $9.00

A dynamic text that shows concrete installment options

Resulting section

Prompt:

Write β€œor 3 installments of {amount} with {image}”.
{amount} should be the cart total divided by 3.
{image} should have this image: https://cdn.shopify.com/s/files/…_link_to_your_file

AI-generated code

<div id="installment-payment" class="tw-flex tw-items-center  tw-mt-1 tw-text-sm">
  <span>or 3 installments of <span id="installment-amount"><b>R0.00</b></span> with </span>
  <img src="https://cdn.shopify.com/s/files/1/0683/2609/7175/files/scentimental-payJustNow.webp?v=1757428106" alt="Payment options" class="tw-ml-2 tw-h-4 tw-object-contain tw-rounded-full">
</div>

<script>
function updateInstallmentDisplay(cartData) {
  const amountElement = document.getElementById('installment-amount');
  if (cartData && amountElement && cartData.total_price > 0) {
    const installmentAmount = (cartData.total_price / 100 / 3).toFixed(2);
    amountElement.textContent = 'R' + installmentAmount;
  }
}

const initialCartData = window.EliteCart.getCurrentCart();
updateInstallmentDisplay(initialCartData);
window.EliteCart.onCartChange(updateInstallmentDisplay);
</script>

Did this answer your question?
😞
😐
😁