Created
April 4, 2019 15:27
-
-
Save PogHallam/f5f049b5bbdb3cdf9e5b2cf67957ef93 to your computer and use it in GitHub Desktop.
Get the label/id of current payment methods. Use this to avoid issues with differing IDs on local/staging/production. e.g. 'flat_rate:9', 'table_rate:5:5', etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$packages = WC()->shipping->get_packages(); | |
foreach ( $packages[0]['rates'] as $key => $shipping_rate ) { | |
dump( [ $shipping_rate->get_id(), $shipping_rate->get_label() ] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment