MarketPress - Exclusion of Sales countries for individual product, not whole shop

Is it possible to exclude a sales-country for an individual product (where we have a legal dispute), so that this product is no longer available for all customers coming from this country?
Can this be blocked on a product basis or does this have to be done for the whole shop?
I intend to mark the product description with the country restriction, so no extra notice would be necessary, but I need to block the sales process for this product for all customers coming (/being identifiable as coming) from a certain country. The general store settings I would do via "Shipping" - "General Settings" - "Choose Target Countries", but how can I set this for an individual product?
I think I have read something about this topic on WPMUDev before, but now cannot find the concerning thread in the help section.
Thank you for your kind help!

  • DavidM

    Hi RGerhart and welcome to WPMU DEV!

    There's not a way to limit access to a product on a country-basis like that without some editing of the MarketPress core code, not something we could really advise on as this one gets a bit extensive.

    Users are asked for their country during checkout so I imagine if you're looking to do something like that it would probably be best done via a customization of the payment gateway(s) you're using.

    Basically, it would involve some custom development though.

    Cheers,
    David

  • RGerhart

    Hi David,

    Thank you very much for your fast help and explanation. I think the development and secure gateway adjustments are beyond my abilities.
    I tested the shop some more and found out, the exit for download products does not have the information of the country at that stage of the order when the buyer is sent to the PayPal site. The country is only entered into the PayPal form and so I think the country exception might not work here.
    As I see it, the possibility to distinguish between the countries would only be later, when PayPal sends the information back to the site and the payment is already made.
    So a possible way to catch the country without an already made payment would only work for shipped products.
    The problematic product unfortunately is a downloadable product, so, as far as I see it, I cannot work with MarketPress to handle this. I hope I am wrong with this, as I like MarketPress.

    Thank you very much for your kind help.
    Best wishes,
    Roswitha

  • RGerhart

    I tried to get a solution by searching for IP address listings checking the country of the visitor. But here I get stuck as the usual solution is to put the code into the htaccess file to completely limit the access to the website, not only to one single product.
    Is there a place in the MarketPress plugin, where a code would fit to limit access to a single product and send, e.g. users from one country to a 'not-available-in-your-country'-page?

  • DavidM

    Hi Roswitha,

    I'm afraid there's not one single place in the MarketPress code that could be done.

    What I think would probably be the easiest and upgrade-safe way to achieve that would be to create custom templates in your theme folder (this is all documented in the file /marketpress-includes/themes/Themeing_MarketPress.txt) and in those files, restrict the display of products using whatever custom code you use to detect their IP.

    If you're not comfortable with that degree of customization, you may want to check out the job boards to see if you can get that done there.
    https://premium.wpmudev.org/wpmu-jobs/

    Cheers,
    David

  • RGerhart

    Thank you very much for your kind help, David.
    The suggestion sounds fine.
    I do not have all too many products right now, so the restricted products should show, even for the restricted area, but only should not be available and show a message, that this product is not available in this region. I am not sure where to put the code in this case.
    So I tried to get a solution via access regulation in the .htaccess for the whole site and sending the restricted area to another entry page.
    But I got stuck with this and gave it to programmers. I hope they can work out a solution.

    Thank you for your help and effort !

    Best wishes,
    Roswitha

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.