The initial idea of this module was to allow custom PHP code to be associated with a product in order to adjust the price of the product. The nature of allowing an admin to enter a block of PHP code to be executed though, allows for much more elaborate and potentially dangerous operations.
Upon installation, this module will add a Custom Code field to your products. Sample uses of this code block are:
$item->price = $item->price;
This will do nothing....but it goes in by default.
$item->price refers to the price before attribute adjustments.
$item->price = $item->price;
if ($item->qty > 5) {
$item->price = [cost] * 1.1;
}
If more than 5 items are ordered, set the product price to a 10% mark-up of the product cost. Product tokens are exposed to this code so things like [cost], [sell_price], [weight], [weight-raw], etc. can be used.
$item->price = $item->price;
if (date('j', time()) == '1') {
$item->price = $item->price/2;
}
Half price on the first of each month.
For additional examples which use attributes for price calculations, refer to the Attribute Tokens module.