0

I have a custom product pricing rule set up in Drupal Commerce which gives users of role Trade a different price by using a different commerce_price field on the product which works fine.

But I need to export the values later on in to a XML file. The original product price is being returned as the rule is set up to use the Current user role, not that of the original user who made the transaction.

Is there anyway to have the rule act on the line item owner or for me to overwrite this in my XML output when calling rules_invoke_event('commerce_product_calculate_sell_price', $line_item);

0

In any product pricing situation, you should always make your user related conditions check against the commerce-order:owner token, not the site:current-user. That sounds like exactly what you need.

  • I tried that but when the XML is generated it seems to use the role of the user that is generating the XML so if the user generating the XML has the Trade role, all prices even non-trade roles get the rule applied. It does work on the front end of the site though, so that is fine and still working. Just the XML export that is the issue. – jamestsymp Dec 19 '13 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.