Note: Taxes are not included in these calculations. If you find this calculator helpful, consider tipping @foundbyphil on Venmo.
function calculateEarnings() { var salePrice = parseFloat(document.getElementById("salePrice").value); var shippingCost = parseFloat(document.getElementById("shippingDiscount").value); var isAmbassador = document.getElementById("poshAmbassador").checked; // Calculate the order total (assuming no taxes for simplicity, but can be added) var orderTotal = salePrice + shippingCost; // Determine the seller fee based on the sale price var fixedFee, variableFee; if (salePrice <= 15.00) { fixedFee = 1; variableFee = Math.round(0.0599 * orderTotal * 100) / 100; // Rounded to 2 decimal places } else if (salePrice > 15.00 && salePrice < 50.00) { fixedFee = 2; variableFee = Math.round(0.0599 * orderTotal * 100) / 100; // Rounded to 2 decimal places } else { fixedFee = 3; variableFee = Math.round(0.0599 * orderTotal * 100) / 100; // Rounded to 2 decimal places } var totalSellerFee = fixedFee + variableFee; // Calculate the shipping cost covered by the seller (if free shipping is offered) var sellerShippingCost = shippingCost === 0 ? 7.97 : 0; // Calculate the total earnings for the seller var sellerEarnings = salePrice - totalSellerFee - sellerShippingCost; // Calculate the buyer's total cost (item + shipping + buyer protection fee) var buyerFixedFee, buyerVariableFee; if (salePrice <= 15.00) { buyerFixedFee = 1; buyerVariableFee = Math.round(0.0599 * orderTotal * 100) / 100; } else if (salePrice > 15.00 && salePrice < 50.00) { buyerFixedFee = 2; buyerVariableFee = Math.round(0.0599 * orderTotal * 100) / 100; } else { buyerFixedFee = 3; buyerVariableFee = Math.round(0.0599 * orderTotal * 100) / 100; } var buyerFee = buyerFixedFee + buyerVariableFee; var totalBuyerCost = salePrice + shippingCost + buyerFee; // Display the detailed result document.getElementById("result").innerHTML = "Seller Earnings: $" + sellerEarnings.toFixed(2) + "