2
Answers
Vote up!
0
Vote down!

Shoping Cart Rule for calculating Total Price with Retail or Whosesale Product Price at Same Role according to Total Amount

I have a problem trying to get one Rule to get the Shopping Cart to calculate the Total Price with Retail Price if less than one amount and if more than that amount use the wholesale price at same role.

Let´s say for example I have a store with products with Cost, Retail Price and Wholesale price and we want that customers that purchase a total of less than US$200 use the Retail Price of each produc, but if the purchase is equal or more than US$200 calculated with the Retail Price, then automatically the Shopping cart update with the Wholesale Price of each of these products.

We want to make this at same role and not with Role Wholesale and Role Retail.

I have thinked in a rule that use 2 shopping cart all the time. But only shows the Total Shopping cart using the Retail Price if less than US$200 and change to the the Wholesale Price if the Shopping cart is equal or more than US$200.

I have been trying to make this in Ubercart with Rules and hook_uc_cart alter with no success at the moment

I am sure this can be done with somehook_uc_cart alter that you can advise.

I am also trying to get this Rule to be acomplished with Drupal Commerce using some Complex Rules in Commerce.

Let me know if you can give me a recipe for this Rule to accomplished what I am looking for

Thanks,

Erick

Asked by: erickbellido
on June 26, 2013

2 Answers

Vote up!
0
Vote down!

i programmed my site to show wholesale prices by rule, and if i remember by one of the step that says USER HAS ROLE (# 4 below), instead of that i think there is an option to select amount is or amount equals something like that you can play around with it, see what i did below and give it a try if you like. I am not an expert at this but i just did it a few days ago and i think that option was there.

Set up a new price field
Go to admin/commerce/config/product-variation-types/product/fields and in the Add new field, type Wholesaler price.
For the field type select Price, then chose the Price with currency widget type and add the field.
On the settings form, it is up to you whether you want to make it required etc. But leave the Number of values set to 1.

Set up the pricing rule
1. Go to admin/config/workflow/rules and click the Add new rule link.
For the name, just enter Wholesaler price.
Under events, choose Calculating the sell price of a product.

2. Under Conditions section click the Add condition link.
From the drop-down, select Entity has field.
Under Entity, for the Data selector set it to commerce-line-item. From the drop-down this will be listed as commerce-line-item (Product line item).
For the field, select commerce_product. Click Save.

3. Add another condition, and select Entity has field again. For the Data selector, choose commerce-line-item:commerce-product. In the drop-down you will need to select commerce-line-item... (Product line item) which will bring up a few more options, from these select commerce-line-item:commerce-product (Product).
Then in the field box select field_wholesaler_price or whatever you called the field in step 2.

4. Lastly, add a new condition select User has role(s). From the data selector chose site:current-user. You can choose this by going to site:...(Site information) then choosing site: current-user (Logged in user).
Then in the Roles section click your wholesaler role.
Save the condition.

5. Finally, under Actions click Add action. In the drop down under Commerce Line Item, select
a. Divide the unit price by some amount and put in amount the value of 2 (so its divided into 2 which is 50% off) or if you want to put your own amount then follow option b.
b. Set the unit price to a specific amount. Under Amount, click the link which says Switch to data selection.
The Data selector should already be set to commerce_line_item.
From the drop down select commerce-line-item:... (Product line item) then select commerce-line-item: commerce-product:... (Product).
Then select your price field which will be commerce-line-item: commerce-product: field-wholesaler-price:... (Wholesaler price).
Then select commerce-line-item: commerce-product: field-wholesaler-price: amount (Amount).
Leave the Price component type set to Base price.
Under Price rounding mode it is up to you how this is set. I put do NOT round at all

Answer by: ariban99
Posted: Jun 27, 2013
Vote up!
0
Vote down!

Thank you Ariban.

For the detailed explanation in how to develop this rule. I have followed all the steps and replicated the rule that you mention to display diferent prices (retail price and wholesale price) for different user roles, but I can not get this rule to work only at the shopping cart so that when the total amount is more than US$200 with the wholesale price calculation, then use the wholesale price of the products instead of the retail price for making the total order at the shopping cart

I have tried what you mention at the beginning of your email, but with no success

"i programmed my site to show wholesale prices by rule, and if i remember by one of the step that says USER HAS ROLE (# 4 below), instead of that i think there is an option to select amount is or amount equals something like that you can play around with it, "

Please let me know how can I add that selecct amount or amout equals so I can change between one price and the other but only in my shopping cart and not in the display.

Thank you very much in advance,

Regards,

Erick Bellido

Answer by: erickbellido
Posted: Aug 2, 2013