Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jakewhiteley/bfd81fde108246aed8cbc4460458b6ac to your computer and use it in GitHub Desktop.
Save jakewhiteley/bfd81fde108246aed8cbc4460458b6ac to your computer and use it in GitHub Desktop.
<?php
add_action( 'woocommerce_ship_to_different_address_checked', 'get_persitent_ship_to_different' );
function get_persitent_ship_to_different ( $value )
{
$data = WC()->session->get('form_data');
if ( ! $data || empty($data['ship_to_different_address']) )
return $value;
return is_bool($data['ship_to_different_address']) ? (int) $data['ship_to_different_address'] : $data['ship_to_different_address'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment