[ad_1]
I’m trying to import products and apply a markup to them based on the category it is a part of.
This is the Code I have in the regular price box:
[my_adjust_price({price[1]},{category[1]})]The code I have in the function editor is as follows:
<?php
function my_adjust_price( $price, $element="" ) {
$adjust_map = array(
'Monitors' => 5.20,
'Networking' => 1.95,
'Graphics Cards' => 4.30
);
return ( array_key_exists( $element, $adjust_map ) ) ? ( number_format( $price * $adjust_map[ $element ], 2 ) ) : $price;
}
?>I’ve followed this link and the solution provided but I’m still having problems and the price doesn’t get adjusted it just returns as blank not zero just straight blank.
