Limit States to Which Shipment Is Allowed in MarketPress

I'm currently in the process of configuring a website for a meadery and another for a microbrewery. MarketPress rather easily allows for limits on shipping to various countries; however, there are other concerns when shipping alcohol (and various other restricted products). In essence, I need a way to limit the States to which shipment is allowed instead of the countries to which shipment is allowed.

Is there any way to accomplish this in MarketPress?

  • Vaughan
    • Support/SLS MockingJay

    hiya

    unfortunately i don't think that's possible. i can add this to the feature requests, as it sounds like a great feature to have, though this isn't going to help you in the short term.

    i don't know of any plugins that will add this functionality either. it would require quite some extensive coding. i will ask the developer to see if he has any suggestions though.

    hope this helps

  • Aaron
    • CTO

    This snippet would prevent them from going past the shipping page without a valid state:

    add_action( 'mp_shipping_process', 'force_states');
    function force_states() {
     global $mp;
     if (!in_array($_POST['state'], array('CA', 'NV', 'OR'))) {
      $mp->cart_checkout_error('Sorry we don't ship to that state');
     }
    }

    You can add to theme's functions.php file or with a code snippets plugin. It's a bit hacky but a decent start.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.