Bug on marketpress shipping plugin

Hi,
I think I found a bug on the marketpress plugin:
On marketpress line #1629:

if (empty($_POST['zip']) && $_POST['country'] != 'IE') //no postal code in Ireland
                    $this->cart_checkout_error(__('Please enter your Zip/Postal Code.', 'mp'), 'zip');

Therefore it is allowed to leave zip code for Ireland.

Same file, on line #2202:

//check required fields
    if ( empty($address1) || empty($city) || empty($zip) || empty($country) || !(is_array($cart) && count($cart)) )
      return false;

Therefore if a shipment to Ireland has not postcode no shipping is charged.

Regards.

  • Sarah
    • WPMU DEV Initiate

    To fix it the following function might be added:

    private function valid_zip($zip, $country)
        {
            if (!empty($zip))
                return true;
    
            // Ireland might have no post code
            if ($country == 'IE')
                return true;
    
            return false;
        }

    And then:

    //check required fields
            if (empty($address1) || empty($city) || empty($country) || !$this->valid_zip($zip, $country) || !(is_array($cart) && count($cart)))
                return false;
  • Jonathan
    • The Bug Hunter

    Thanks for this @Sarah! Not only does Ireland not use post codes, but I think there are a handful of other countries that don't use post codes either. We'll make sure when we fix this that we also look into the other countries as well. :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.