Closed (works as designed)
Project:
Commerce Core
Version:
7.x-1.0
Component:
Checkout
Priority:
Major
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
18 Jun 2012 at 20:39 UTC
Updated:
19 Jun 2012 at 22:43 UTC
Is there a way to programmatically apply product discounts using the Drupal Commerce API? That is, without Rules, using good old fashion php code. I'm trying to integrate Commerce with a few other modules, and I need to apply the discounts from the code base.
Granted, I'm no Drupal Commerce pro, but after tirelessly searching the Drupal Commerce API Documentation, and the Commerce Guys website (and the World Wide Web, or for that matter), there seems no documentation on how to do this and other things which should be relatively simple. I've looked at the Commerce Coupon API, and there's no documentation for that either. If anyone knows the code, please paste it below. A million thanks!
Comments
Comment #1
marcin.wosinek commentedCurrently there is no way to do this without rules. I'm not sure if there would be a point in introducing hook for this task, because as I understand commerce rely by design on rules for pricing. This way it's easy for site builders/administrators to change pricing rules.
You can store rules in your module code, so default configuration will be easily portable.
Btw, according to project page support request are supposed to be posted on commerce Q&A.
Comment #2
ocargile commentedThanks Marcin.