I used "Execute custom PHP code" in my pricing rule.
However I got Notice when I checkout:
Notice: Use of undefined constant testsku - assumed 'testsku' in eval() (line 7 of /var/www/jmu/sites/all/modules/rules/modules/php.eval.inc(146) : eval()'d code). Notice: Undefined variable: line_item in eval() (line 7 of /var/www/jmu/sites/all/modules/rules/modules/php.eval.inc(146) : eval()'d code).
I know there must be something wrong with my token replace code:
$line_item_label = token_replace([commerce-line-item:line-item-label],array('commerce_line_item' =>$line_item));
I used "line-item-label" as product sku's machine name
Anyone have any idea about this?
$line_item_label
? It seems to me that this variable has the value testsku and that you misused it as a constant somewhere else. Your error also demonstrates that you should avoid using PHP code in a Rule. See drupal.stackexchange.com/a/108447/16550 for example.