• Hello Support,

    We are encountering a critical issue, and I believe this could affect all customers under similar circumstances.

    Our website is configured in WooCommerce to “Sell to specific countries” and “Ship to specific countries” with the United States as the only allowed option. As a result, customers should only be able to enter billing and shipping addresses within the US.

    However, we recently encountered a situation where a customer used Apple Pay for payment. The billing address associated with their saved card was a UK address, which allowed them to complete the order successfully, bypassing our country restrictions. This behavior contradicts our WooCommerce configuration, and I believe it may indicate a bug.

    Please let us know your thoughts.

Viewing 1 replies (of 1 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @shyamzin

    Regardless of the payment method being used, the standard WooCommerce checkout logic is used to create the order and process the payment.

    WooCommerce should perform a validation during the checkout process to ensure all billing and shipping address info is adhering to your configurations. Reviewing the WooCommerce plugin, they don’t appear to validate that the billing country value is within the configured list of countries to sell to.

    You can use action woocommerce_after_checkout_validation to add this validation.

    Example: (test before implementing)

    add_action('woocommerce_after_checkout_validation', function($data, $errors){
    if(isset($data['billing_country'])){
    $country = $data['billing_country'];
    $allowed_countries = WC()->countries->get_allowed_countries();
    if ( ! array_key_exists( $country, $allowed_countries ) ) {
    $errors->add('country_validation', sprintf('Our shop does not ship to %s', $allowed_countries) );
    }
    }
    }, 10, 2);

    Kind Regards

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.