I'm trying to set the price of the item being added to the cart by a global variable, which is a number field. Here's what I have:
craft()->on('commerce_lineItems.onPopulateLineItem', function($event)
{
$lineItem = $event->params['lineItem'];
$globalPrices = craft()->globals->getSetByHandle('defaultPrices');
$itemPrice = var_dump($globalPrices->fontStylePrice);
$lineItem->price = $itemPrice;
This just results in a $0 price being set, and not the value from the Global Variable. But again, $lineItem->price = 25
works fine. Any suggestions?
var_dump($globalPrices->fontStylePrice);
in place or is that just a typo in your code example? – Brad Bell Aug 22 '16 at 0:42