rpress_delivery_address_meta

Author: RestroPress 2 views

This filter is applied to use the delivery address metadata, it includes one parameter.
$this->delivery_address is containing delivery address.

function rpress_store_custom_fields( $delivery_address_meta ) {
$delivery_address_meta['address'] = !empty( $_POST['rpress_street_address'] ) ? sanitize_text_field( $_POST['rpress_street_address'] ) : '';
$delivery_address_meta['flat'] = !empty( $_POST['rpress_apt_suite'] ) ? sanitize_text_field( $_POST['rpress_apt_suite'] ) : '';
$delivery_address_meta['city'] = !empty( $_POST['rpress_city'] ) ? sanitize_text_field( $_POST['rpress_city'] ) : '';
$delivery_address_meta['postcode'] = !empty( $_POST['rpress_postcode'] ) ? sanitize_text_field( $_POST['rpress_postcode'] ) : '';
return $delivery_address_meta;
add_filter( 'rpress_delivery_address_meta', 'rpress_store_custom_fields');