• Resolved LPackman

    (@furnituresuppliesuk)


    Hello,

    I understand how to increase prices by percentage asper your snipet [round_price({price[1]},”1.2″,”10″,”.05″)]
    is it possible to also add a fee after the percentage is added? For example, add 20% then also add £20 or would I have to add the £20 in a separate import ? And if so how can I input this, please.

    Any advice would be great.

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @furnituresuppliesuk,

    You can adjust the “round_price” function to accept an additional parameter and add it after the calculations. For example:

    function round_price( $price = null, $multiplier = 1, $nearest = .01, $minus = 0, $additional = 0 ) {
    	if ( ! empty( $price ) ) {
    		// strip any extra characters from price
    		$price = preg_replace( "/[^0-9,.]/", "", $price );
    		// perform calculations
    		$price = ( round ( ( $price * $multiplier ) / $nearest ) * $nearest ) - $minus; 
    		
    		return ( empty( $additional ) ) ? $price : round( $price + $additional, 2 );
    	}
    }

    You’d use it like so:

    [round_price({price[1]},"1.2","10",".05","20")]

    In this case, 20 would be added to the price.

    Thread Starter LPackman

    (@furnituresuppliesuk)

    This is perfect! Thank you so much.

    Kind regards

    Thread Starter LPackman

    (@furnituresuppliesuk)

    Hello again,

    Thank you for previously providing a solution. This works well and has been a lifesaver until now as some items now require different fees.

    Please can you tell me how to correctly replace the fixed fee so it is also pulled from csv file?

    i.e

    [round_price({price[1]},”1.2″,”10″,”.05″,”{fixedfee[1]}”)]

    Many thanks again for your assistance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add fixed amount to price on import’ is closed to new replies.