Uploaded image for project: 'PUBLIC - Liferay Commerce'
  1. PUBLIC - Liferay Commerce
  2. COMMERCE-3726

Product option value relative price should also include differences in CPInstance prices

    Details

      Description

      Currently, relative product option value price is calculated ONLY based on price difference between selected and non-selected product option value:

      • if priceType is static, difference is [selectedOptionValue.price - nonSelectedOptionValue. price]
      • if priceType is dynamic, difference is [selectedOptionValueCPInstance.finalPrice - nonSelectedOptionValueCPInstance.finalPrice]

      If options are SKU contributors, the algorithm should also take into account the difference in price between SKUs that defines currently selected and non-selected option values!

      Steps to reproduce:

      1. Setup a product bundle in Admin UI (for simplicity we can use priceType=static options so no need to create additional products)
        • Create 1 simple product which will represent a product bundle
        • add 1 SKU contributing option with priceType=static (use single select field type, "select from list"  field type is bugged), and add 2 option values
        • define prices for option values (for example value1 = 20 $, value2 = 40$)
        • generate product bundle SKUs for each option value
        • define different prices for each SKU (value1 SKU = 5$, value2 SKU = 10$)
      1. In Storefront select the created product bundle

      Expected behavior:

      Option value relative prices should include a difference in SKU prices. Total price of value1 SKU is  20+5 = 25$, price of value2 SKU is 40=10 = 50$ which means if value 1 option/SKU is selected relative price of value 2 option should be +25$, if value 2 option/SKU is selected relative price of value 1 option should be -25$ etc...

      Feel free to add more options, with dynamic priceType and test more complex cases!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pietro.bocale Pietro Bocale
              Reporter:
              matija.petanjek Matija Petanjek
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Packages

                  Version Package
                  2.1.1