Skip to content

Instantly share code, notes, and snippets.

@varun-pluginhive
Created November 10, 2018 09:43
Show Gist options
  • Select an option

  • Save varun-pluginhive/817af6c946c4c8ff15b844ca31e7023f to your computer and use it in GitHub Desktop.

Select an option

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/
/**
* 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