2

I created a content type (main prod) that is referencing a product content type (sub prod). The sub prod is also referencing another product content type called (option sets) which will be the option sets of that product, with the use of Commerce Product Bundle I was able to combine all the different prices of the sub prod and the option sets and with the use of Commerce Product Attributes I am able to change the option sets to a list text field.

I applied a patch that I saw to calculate the total price of all the chosen option sets and the sub prod on the cart and checkout page. My problem is on the product page itself I want the price of the sub prod to be calculated depending on the option sets chosen via real time of with using ajax.

Can anybody help?

This is the list of commerce modules I have currently installed on my site.

1
  • You need custom code. Try creating a JSON object and cache for each combination and use it display the price real time on user's selection of options.
    – nikunj
    Commented Jan 5, 2016 at 10:16

2 Answers 2

0

The answer is that "Commerce Product Bundles" (https://www.drupal.org/project/commerce_product_bundle) is never recommended since it circumvents large portions of Drupal Commerce. You should consider using line item fields or https://www.drupal.org/project/commerce_bundle if bundling is important to you.

Note: Custom line item fields also suffer from not having ajax updates. The community effort to make this a reality can be found here: https://www.drupal.org/node/1541886 and a video that describes an interesting use case for line item fields is here: https://www.youtube.com/watch?v=j9KsyvQZaAY

2
  • I would like to avoid creating fields since I plan to let other people create the products for me (not admin). For example I have different Venues with an option set of "number of person" and with each venue the option set "number of person" has a different price. On the link Pizza Shop video the Topping "Pepperoni" was given a price of 1.00 dollar which is constant for all the "Pepperoni" toppings. Is there anyway to change the given price of that field depending on what the user wants to put in? Commented Jan 6, 2016 at 2:23
  • Sounds like your use case is more like Commerce Registration (Add to Cart > Checkout > Register for event) or Registration Commerce (Register for event > Checkout). Both use the Entity Registration module that allows EACH registration have different attributes. I'm not sure you can have different prices for each attribute, but worth checking out.
    – joshmiller
    Commented Jan 6, 2016 at 11:41
0

If you are using Drupal 7 - what you are looking for might be module custom_price, or Rules module(maybe with conditional_rules extension). If you are using Drupal 8 - your options are either Rules module or writing a whole custom module that will be intercepting showed and calculated price based on specific rules that you would create.

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.