3

I want to add custom field for quantity in custom option value like given in image. I tried following Magento 2 add new custom option text field but it add earlier while i need it with custom option value.

enter image description here

Any help will be appreciated.

1
  • hi @rajibit singh whether you need this QTY field only to radio button input type (or) for all input types? Commented May 20, 2017 at 9:51

2 Answers 2

6

Please follow below steps:

Step1: First of all keep back up "CustomOptions.php" from the below mentioned path

i.e Magento2Root/vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php

Step 2: Please follow the below github link and download the file and place the same in the respected (mentioned) path. Click Here Github Link

Step 3: Please create a database column in the name of 'qty_option' for the below 2 tables

catalog_product_option

catalog_product_option_type_value

enter image description here

Step 4: Clear cache and page_cache and re login into admin and check the same.

Note: Once it works using meld tool identify the changes what i did in the CustomOptions.php

Using plugin concept try to achieve the same from your end. Thanks

output

2
  • Thanks, but i need a little bit more on it. example A product default price is 10, first custom options price is 2, second custom options price is 3 if I add one quantity to cart the subtotal is (10+2+3)*1 = 15 But if I add two or more quantity it should work as like instead of the default, so the final price should be (10*2)+2+3=>25 always the custom options should add only one time to the default price Commented Mar 28, 2018 at 15:13
  • Hello @Nagaraju .. I have followed the steps. I see Qty box in admin but the value doesn't get saved.. Commented Jun 22, 2020 at 10:22
0

If anyone is still struggling with that, then you can follow this https://magento.stackexchange.com/a/220754/21432

This helped me to resolve my problem. And hope this helps anyone else too!

This explains how you can add a new field with option line item within a bundle.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.