Last active
December 4, 2019 23:49
-
-
Save robertdevore/fa79a76704fa8dc6d831017486a7756f to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* Change the origin address in the driver dashboard | |
* to display the customer's Billing Address | |
* | |
* @author Robert DeVore <deviodigital@gmail.com> | |
* @link https://www.wordpress.org/plugins/delivery-drivers-for-woocommerce/ | |
* @return string | |
*/ | |
function acme_google_maps_origin_address( $store_address ) { | |
// Get an instance of the WC_Order object | |
$order = wc_get_order( $_GET['orderid'] ); | |
// Get the order data. | |
$order_data = $order->get_data(); | |
// Specific order data. | |
$order_billing_address_1 = $order_data['billing']['address_1']; | |
$order_billing_address_2 = $order_data['billing']['address_2']; | |
$order_billing_city = $order_data['billing']['city']; | |
$order_billing_state = $order_data['billing']['state']; | |
$order_billing_country = $order_data['billing']['country']; | |
$order_billing_postcode = $order_data['billing']['postcode']; | |
$store_address = $order_billing_address_1 . ' ' . $order_billing_address_2 . ' ' . $order_billing_city . ' ' . $order_billing_state . ' ' . $order_billing_country . ' ' . $order_billing_postcode; | |
return $store_address; | |
} | |
add_filter( 'ddwc_google_maps_origin_address', 'acme_google_maps_origin_address' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment