Same as @saurabh.dhariwal's steps, but improved and more verbose:
Create new ...

Contribution Date
Technology
Contribution Project
Contribution Details

Same as @saurabh.dhariwal's steps, but improved and more verbose:

  • Create new taxonomy named "Pizza Toppings", and add new field Price in it.
  • Add terms in "Pizza Toppings" like Cheese, Garlic etc with associative price.
  • Add new field in line item (Product) with term reference (Pizza Toppings).
  • Tick "Include this field on Add to Cart forms for line items of this type" checkbox under "ADD TO CART FORM SETTINGS". This will display your "Pizza toppings" terms on add to cart form.
  • Make sure the field is multivalued
  • Now create new "Product Pricing rule" from Store > Configuration > Product Pricing Rule.
    • Select event "Calculating the sell price of a product".
    • Add Condition "Entity has field" with Data selector "commerce-line-item" and field "field_pizza_toppings"
    • In Action section, add Loop for commerce-line-item:field-pizza-toppings data selector. Say, the variable name is pizza_topping
    • Add action under Loop to "Add an amount to the unit price" with data selector as commerce_line_item and for AMOUNT pizza-topping:field-price:amount
    • Select fee from drop down as "PRICE COMPONENT TYPE".
Contribution Author
Files count
0
Patches count
0