Skip to content

Change category product position via Developer Console with jQuery and save

When I want to change a Magento 2 Category’s Products position you can do so by manually editing the Position column number field which works just fine.

I want to edit those position numbers via jQuery in the Chrome Developer Console and click the ‘Save’ button to save those changes.

I can change all the inputs for position in the developer console by doing the following:

var setPosition = jQuery("td.editable div.admin__grid-control input[type=text]");
setPosition.val("999").trigger('change');
setPosition.attr("value","999").trigger('change');

However, on clicking the ‘Save’ button nothing is saved.

How do I get the ‘Save’ button to save those changes?