Use WC Customer API to retrieve billing and shipping countries

This commit is contained in:
George Burduli 2024-05-31 13:07:41 +04:00
parent b1bfa2940b
commit 4a3345113b
No known key found for this signature in database
GPG key ID: 572A97DFDA3D2E5C

View file

@ -56,13 +56,13 @@ class PayUponInvoiceHelper {
} }
// phpcs:ignore WordPress.Security.NonceVerification.Missing // phpcs:ignore WordPress.Security.NonceVerification.Missing
$billing_country = wc_clean( wp_unslash( $_POST['country'] ?? '' ) ); $billing_country = WC()->customer->get_billing_country();
if ( empty( $billing_country ) || 'DE' !== $billing_country ) { if ( empty( $billing_country ) || 'DE' !== $billing_country ) {
return false; return false;
} }
// phpcs:ignore WordPress.Security.NonceVerification.Missing // phpcs:ignore WordPress.Security.NonceVerification.Missing
$shipping_country = wc_clean( wp_unslash( $_POST['s_country'] ?? '' ) ); $shipping_country = WC()->customer->get_shipping_country();
if ( empty( $shipping_country ) || 'DE' !== $shipping_country ) { if ( empty( $shipping_country ) || 'DE' !== $shipping_country ) {
return false; return false;
} }