I am using Increase Shipping cost per categories count found in WooCommerce cart answer code from my previous question.
How to exclude subcategories from the array of product categories Ids, to keep only top categories?
According to the solution for this custom calculation, Sub-categories are also included for calculating shipping costs. I would need them to be excluded since they are used only for sorting items.
I tried with adding a filter to the array but brakes the site.