import React from "react"; import { useProduct } from "vtex.product-context"; import styles from "./styles.css"; const Pix = () => { const product = useProduct(); const precoAtual = Number( product?.product?.priceRange.sellingPrice.highPrice ); const desconto = (precoAtual * 10) / 100; const precoNovo = precoAtual - desconto; const fechApi = async () => { fetch("/api/checkout/pub/orderForms/simulation", { method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json", }, body: `{ "items": [ { "id": ${product?.selectedItem?.itemId}, "seller": ${product?.selectedItem?.sellers[0].sellerId}, "quantity": ${product?.selectedQuantity} } ], "country": "BRA" }`, }) .then((response) => response.json()) .then((data) => { console.log(data); }); }; fechApi(); return (
logo do Pix

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

10 % de desconto

); }; export default Pix;