import React, { FC } from 'react' import { useProduct } from 'vtex.product-context' import styles from "./styles.css"; export const DescontPix: FC = () => { const productContextValue = useProduct(); console.log(productContextValue); // const fetchApi = async () => { // fetch("/api/checkout/pub/orderForms/simulation", { // method: "POST", // headers: { // Accept: "application/json", // "Content-Type": "application/json", // }, // body: ` // { // "items": [ // { // "id": ${productContextValue?.selectedItem?.itemId}, // "seller": ${productContextValue?.selectedItem?.sellers[0].sellerId}, // "quantity": ${productContextValue?.selectedQuantity} // ] // } // ], // "country": "BRA" // }`, // }) // .then((response) => response.json()) // .then((data) => { // console.log(data) // }) // } // fetchApi(); let sellingPrice = Number(productContextValue?.product?.priceRange.sellingPrice.highPrice); sellingPrice = (sellingPrice - (sellingPrice/10)); return (
Logo PIX
R$ {sellingPrice.toFixed(2).replace(".", ",")} 10 % de desconto
); }