This function allows you to adjust your prices based on an element in your import. In this example, we pass the category to the function and mark-up prices based on that:
function my_adjust_price( $price, $element = '' ) {
$adjust_map = array(
'Monitor LED' => 1.20,
'PC Notebook Consumer' => 1.25,
'TV LED' => 1.30
);
return ( array_key_exists( $element, $adjust_map ) ) ? ( number_format( $price * $adjust_map[ $element ], 2 ) ) : $price;
}
Usage example:
[my_adjust_price({price[1]},{category[1]})]
Please tell me how I can improve the function. Increase the price of all products by 1.5 except those listed in the $adjust_map array