Created
November 10, 2018 09:43
-
-
Save varun-pluginhive/817af6c946c4c8ff15b844ca31e7023f to your computer and use it in GitHub Desktop.
Snippet to get selected shipping method while checkout. Note - It won't work from backend. Estimated Delivery Date Plugin For WooCommerce - https://www.pluginhive.com/product/estimated-delivery-date-plugin-woocommerce/
This file contains hidden or 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
| /** | |
| * Snippet to get selected shipping method while checkout. Note - It won't work from backend estimated delivery calculation. | |
| * Created at : 10 Nov 2018 | |
| * Updated at : 10 Nov 2018 | |
| * PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
| * Gist Link : https://gist.github.com/varun-pluginhive/817af6c946c4c8ff15b844ca31e7023f | |
| */ | |
| add_filter( 'ph_estimated_delivery_selected_shipping_method_on_order', function( $shipping_method ){ | |
| if( ! empty($_POST['shipping_method']) ) { | |
| $shipping_method = current($_POST['shipping_method']); | |
| } | |
| return $shipping_method; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment