• Resolved miguelpenas

    (@miguelpenas)


    Good night,

    I need to do a function for the selling price of the products.
    It will be the priceB2B + 5€ (shipping) + 23% (VAT) + 23% (profit)
    I’m not getting the job done. Is it possible to help?
    Printscreen on this link.Print exampleo

    On Regular price field I’m putting this: [correct_price({priceB2B[1]})]

    <?php
    function finalprice($priceB2B = null, $shipping =5, $vat = 23, $profit = 23){
        $only_shipping = ($priceB2B / 100) + $shipping;
        $pricewithship = $priceB2B + $shipping;
    	$only_vat = ($pricewithship / 100) * $vat; 
    	$price_n_vat = $pricewithship + $only_vat; 
    	$profit = ($price_n_profit / 100) * $profit;  
    	$payprice = $price_n_profit + $tax;  
    	echo correct_price;
    }
    ?>
Viewing 1 replies (of 1 total)
  • Thread Starter miguelpenas

    (@miguelpenas)

    Solved:
    <?php
    function preco_final( $priceB2B,$portes=5,$iva=23,$lucro=23 ) {
    $preco_sem_portes=0;
    $preco_sem_portes = $priceB2B + $portes;
    $preco_sem_portes = round($preco_sem_portes, 2);
    $preco_com_iva = $preco_sem_portes + ($iva*($preco_sem_portes/100));
    $preco_com_iva = round($preco_com_iva, 2);
    $preco_com_lucro = $preco_com_iva + ($lucro*($preco_com_iva/100));
    $preco_com_lucro = round($preco_com_lucro, 2);
    return $preco_com_lucro;
    }
    ?>

Viewing 1 replies (of 1 total)

The topic ‘Regular price function editor’ is closed to new replies.