The Table Rate shipping method for WooCommerce comes with four fundamental cost types, but there may be times when your shipping model requires something a little more. This is where the extensive list of filters and action hooks come in handy. With a little PHP knowledge, you can use these filters to add a new cost option that will work seamlessly alongside the default settings.
Adding On to Existing Cost Types
The four primary cost types cover nearly all of the basic price calculations the average user would need to calculate shipping costs. However, if you have added a new condition following the Adding a New Condition developer docs, it may be useful to add that feature to the cost options as well. For this example, let’s assume you have followed the guide in that article and now have a ‘Longest Length’ condition in your method. The ‘multiplied by’ and ‘for every’ cost types could benefit from this by adding the ability to calculate it against the longest length instead of the total length.
Adding a new condition handles much of the work. The code for the new condition calculates the longest length already, so you simply need to add the option to the Cost select boxes and you are done!