Jump to content

product shipping restrected for some countries/regions

Recommended Posts

due to oversize, I cannot ship outside EU some products. I intend to restrict the shipping for this product, so at the checkout the buyer is informed that the product cannot be shipped outside EU.

does anyone knows how to do this restriction? I checked both catalog and shipping, but no such option.


Link to comment
Share on other sites

It's not possible. The best you can do is choose "Disable carrier" as the "Out-of-range" behaviour for the outside EU carriers, so that when the total weight of the cart is higher than the highest range, the carrier cannot be selected. That will display "There are no carriers available that will deliver to that address" though. You'll need to add code to check if no carrier are available and then display a message like "Your cart is too heavy to be shipped to your country".

Link to comment
Share on other sites

thanks for the suggestion
unfortunately this solution does not fit the purpose. I missed to explain exactly the situation, it's my fault.

the exact situation is like this:
- the real problem for sending outside EU is the customs formalities: some of the products, because they do not fit in an envelope (so it's volume rather than weight), must pass the custom control which is very time consuming and expensive (40 eur for one parcel)
- for EU the customers cat have then delivered all products, but for outside EU just part of them

I tried to setup the for non-EU countries a carrier that has a upper limit for weight. and tried to alter the real weight of the products that cannot be shipped outside EU from 0.5kg to 25kg. this way i can be sure that if someone buys even 10 of the allowed products the shipping can be carried out, but if ads one of the non-allowed it is disabled.
the problem is now that the altered weight messes up the shipping of the non-allowed products for outside EU when they are order within EU. If someone from EU places a 25kg product in the cart, the shipping cost will be too high now. ideally I would have set the EU carrier with price range and outside carrier with weight range, but this is not possible.

I was thinking of an incompatibility between products and countries option, there are several such situations: redbull to france, chewing gum to singapore, ipad to israel etc. so cases like this exist.

Link to comment
Share on other sites

this would be an elegant solution, though not sure how easy to implement.

the problem is that this has significant influence over our business model (and of course revenues), and maybe we have to cut into the core code for the change.

Link to comment
Share on other sites

I've started looking into it. There are quite a number of places where the DB is accessed directly to get a list of products. So I don't see a clean way to make the change. I'e made some notes as I progressed:

In the backoffice the functionality could be managed in a similar way to how products are allocated to categories.

Created a module that creates a database table with columns id_product and id_country - stores which product/country pairs to exclude
Modified AdminProducts.php, tabpane.css, ajax.php to add a new tab "exclude"
Create a countryBox checkbox list of countries in a similar way to categoryBox, this also requires duplicating the related functions in Products.php: getIndexedCategories, updateCategories, deleteCategories. Need to be careful when countryBox is empty - this does not happen with categories. This was added into the new "exclude" tab.

That seems to pretty much get the back office working.

For the front office:

create an entry in the cookie that stores the present country (could be updated based on the IP address to begin with)

Add a condition to the WHERE clause in the various SQL queries that list products, something like:

AND NOT EXISTS (select * from `'._DB_PREFIX_.'toolexclude_product` ex where p.`id_product` = ex.`id_product` AND ex.`id_country` = '.intval($cookie->location).')

The SQL queries that I modified were in:

Category.php getProducts
Search.php findany
Search.php find
Product.php getProducts
Product.php getDefaultCategoryProducts
Product.php getNewProducts
Product.php getRandomSpecial
Product.php getPricesDrop

There are no doubt some others but I think this covers the functionality I'm using.

Modify cart.php so it checks if the product is excluded before adding

Modify processAddress in order.php to check if the delivery address is OK for all products in the cart.

That seems to be providing the basic functionality. Still needs more testing.

Link to comment
Share on other sites

  • 3 months later...
  • 11 months later...

I have a similar question . I want to restrict or better said NOT to show some products for different languages.


For instance we are also selling books in German and English language. If visitor clicks on German flag (German language) I don't want to show him the English ones or vice versa.


But I don't have problem to send them in Germany - Just don't want to show them.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...