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.

  • hi @rajibit singh whether you need this QTY field only to radio button input type (or) for all input types? – Nagaraju K May 20 '17 at 9:51
5

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

| improve this answer | |
  • 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 – senthil Mar 28 '18 at 15:13
  • Hello @Nagaraju .. I have followed the steps. I see Qty box in admin but the value doesn't get saved.. – Arjun Jun 22 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.