How to manage Magento 2 product attribute values options using console

This is an update to my previous script which was used to add custom product attribute values using backend – Add values to product attribute Read the previous^ part to get introduction about how it works. you will have to use browser console (ctrl + shift +j in Google chrome) First of all initialize the array mimim with the final set of values you want to see in backend. The script then automatically removes the extra options first(values which are not in mimim but in present in backend), then it adds the remaining values from mimim (which are in mimim but not at backend) ...

November 22, 2017 · 1 min · Harshvardhan Malpani

Insert Indian States in Magento Database

Connect to your server’s database using mysql cli or phpmyadmin and use the following query INSERT INTO `directory_country_region` VALUES (NULL,"IN","AP","Andhra Pradesh"), (NULL,"IN","AR","Arunachal Pradesh"), (NULL,"IN","AS","Assam"), (NULL,"IN","BR","Bihar"), (NULL,"IN","CG","Chhattisgarh"), (NULL,"IN","GA","Goa"), (NULL,"IN","GJ","Gujarat"), (NULL,"IN","HR","Haryana"), (NULL,"IN","HP","Himachal Pradesh"), (NULL,"IN","JK","Jammu and Kashmir"), (NULL,"IN","JH","Jharkhand"), (NULL,"IN","KA","Karnataka"), (NULL,"IN","KL","Kerala"), (NULL,"IN","MP","Madhya Pradesh"), (NULL,"IN","MH","Maharashtra"), (NULL,"IN","MN","Manipur"), (NULL,"IN","ML","Meghalaya"), (NULL,"IN","MZ","Mizoram"), (NULL,"IN","NL","Nagaland"), (NULL,"IN","OD","Odisha"), (NULL,"IN","PB","Punjab"), (NULL,"IN","RJ","Rajasthan"), (NULL,"IN","SK","Sikkim"), (NULL,"IN","TN","Tamil Nadu"), (NULL,"IN","TL","Telangana"), (NULL,"IN","TR","Tripura"), (NULL,"IN","UK","Uttarakhand"), (NULL,"IN","UP","Uttar Pradesh"), (NULL,"IN","WB","West Bengal"), (NULL,"IN","AN","Andaman and Nicobar Islands"), (NULL,"IN","CH","Chandigarh"), (NULL,"IN","DH","Dadra and Nagar Haveli"), (NULL,"IN","DD","Daman and Diu"), (NULL,"IN","DL","Delhi"), (NULL,"IN","LD","Lakshadweep"), (NULL,"IN","PY","Puducherry");

November 1, 2017 · 1 min · Harshvardhan Malpani

Magento 2.1x – Add options in custom product attribute using backend

Go to the attribute edit page using magento 2 admin panel (Stores > Attributes > Product > Edit attribute) Use console – ctrl + shift + J Edit the js array mimim and then paste the following code in console. $jq=new jQuery.noConflict(); var mimim=["Black","Blue","Blue Black"]; $jq.each(mimim,function(a,b){ $jq("#add_new_option_button").click(); $jq("#manage-options-panel tbody tr:last-child td:nth-child(3) input").val(b); });

October 14, 2017 · 1 min · Harshvardhan Malpani