Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: shipment addresses filter hook #192

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexmigf
Copy link

@alexmigf alexmigf commented Oct 23, 2024

This pull request introduces a new filter postnl_shipment_addresses to modify shipment addresses before generating PostNL shipping labels. The filter is necessary to handle specific address formats used in our plugin, which appends the house number directly to the address_1 field. Without this filter, the shipping label would display the house number twice—once in address_1 and once in the HouseNr field.

Usage:

add_filter( 'postnl_shipment_addresses', function( $addresses, $client ) {
	if ( ! empty( $addresses[0]['HouseNr'] ) ) {
		$addresses[0]['HouseNr'] = '';
	}
	
	return $addresses;
}, 10, 2 );

Benefits:

  • Ensures correct address formatting for our plugin, preventing duplicated house numbers on PostNL shipping labels.
  • Provides a flexible solution that could benefit other scenarios with different address formatting requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant