import React, { useEffect } from "react"; import { useProduct } from "vtex.product-context"; import styles from "./styles.module.css"; const PixDiscount = () => { useEffect(() => { const inputCep = document.querySelector(".vtex-address-form-4-x-input"); inputCep?.setAttribute("placeholder", "Digite seu CEP"); }); const productContextValue = useProduct(); const productPrice = productContextValue?.product?.priceRange?.sellingPrice?.lowPrice; const discount = (Number(productPrice) * 10) / 100; const totalDiscount = Number(productPrice) - Number(discount.toFixed(2)); return (
Imagem Pix

R$ {totalDiscount.toFixed(2).replace(".", ",")}

10% de desconto

) } export default PixDiscount;