0

I am struggling with selecting Tax Rates in Magento 2.4.4.

There was a fantastic answer to this issue: How to select multiple tax-rate In Magento 2?

Where the Console code lets us select ALL tax rates listed. However, I need to select only 20,000 of 40,000 tax rates. And I'd really like to not do that manually. Is anyone able to edit this code to allow a text search?

I was trying (without any luck) all sorts of versions of something like:

require(["jquery"],function($){
$( ".mselect-fixed label" ).each(function( index ) {
  if($(this).children("input").hasClass("mselect-checked")){}
  else if($(this).children("span").includes("WI")){$(this).trigger('click');
    }});
});

tax rates selected in Magento 2

1 Answer 1

0

Tested on 2.4.3-p1.

The following code selects the first 2 rates. Replace 2 with 20000 and it should work.

require(["jquery"],function($){
  $( ".mselect-list-item label" ).each(function(index) { 
    if(index < 2)
       if(!$(this).children("input").hasClass("mselect-checked")){this.click()}
  });
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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