Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save clifgriffin/55647fc417b3da24fb4b1159b5987ec7 to your computer and use it in GitHub Desktop.
Save clifgriffin/55647fc417b3da24fb4b1159b5987ec7 to your computer and use it in GitHub Desktop.
<?php
function custom_output_pickup_instructions( \WC_Order $order ) {
$location = $order->get_meta( '_cfw_pickup_location', true );
if ( empty( $location ) ) {
return;
}
$raw_address = get_post_meta( $location, 'cfw_pl_address', true );
/**
* Whether to link the local pickup address to Google Maps for directions
*
* @since 7.3.2
* @param bool $link Whether to link the local pickup address to Google Maps
*/
if ( apply_filters( 'cfw_local_pickup_use_google_address_link', true ) ) {
$address = sprintf( '<a href="https://www.google.com/maps/dir/?api=1&destination=%s">%s</a>', rawurlencode( $raw_address ), wpautop( $raw_address ) );
} else {
$address = wpautop( $raw_address );
}
?>
<h3>
<?php
/**
* Filter the pickup instructions
*
* @since 7.3.2
* @param string $instructions The pickup instructions
* @param WC_Order $order The order
*/
echo esc_html( apply_filters( 'cfw_order_updates_heading', __( 'Pickup instructions', 'checkout-wc' ), $order ) );
?>
</h3>
<?php
/**
* Filters pickup instructions text
*
* @since 7.3.0
*
* @param string $pickup_instructions_text Thank you page order updates text
*/
echo wp_kses_post( wpautop( apply_filters( 'cfw_pickup_instructions_text', get_post_meta( $location, 'cfw_pl_instructions', true ), $order ) ) );
?>
<h4>
<?php cfw_e( 'Address', 'woocommerce' ); ?>
</h4>
<?php
echo wp_kses_post( $address );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment