1

I am working on a website that uses the following modules to create products.

Domain Module to create different domains for different store owners. Drupal Commerce to create products and ecommerce facility.

The idea is each store admin will have a different domain in the website so that they can setup there stores. Also they are able to create the products for their own. The product types have a field called "Commission", which stores a value in it. It is used to pay back some commission to the store owners if that product is purchased from the site owner's store.

Each site owner has a admin page where a custom module sets a variable called "Discount" which will denote the percentage of discount to apply in each product globally only to that domain.

As an example, suppose a domain store has a product with $100 and that product has a Commission 25% the upon selling that product the domain's site owner will get $25. But if that site owner sets the global Discount variable as 50% then the buying user will have a discount on $100 product of 12.5% as $87.50 and the site owner will get commission as 12.5% as $12.50.

Is there any way or HOOK that I could use to alter the price once it goes to the Checkout page?

1 Answer 1

2

The easiest thing is to hook into rules, as there is a rules event, for when the price for a product is being calculated: commerce_product_calculate_sell_price. This event is designed to hook into, in order to change price for discounts and the like.

You can create your own custom action to provide the discount, or try to use the Rules interface to setup the logic there.

2
  • thanks, I will give it a try and let you know if it worked. Commented Dec 9, 2012 at 10:19
  • Well I tried and it worked. I made some custom Rules condition and actions and those made the trick for me. I am adding it as answer to my question also. Commented Dec 15, 2012 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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