New Zenner
- Join Date:
- Jun 2009
- Posts:
- 2
- Plugin Contributions:
- 0
Disable sales to a specific state
I'm looking for a way to disable sales for only one product since it cannot be sold in that state. Any help would be appreciated.
Views: 3,946
New Zenner
I'm looking for a way to disable sales for only one product since it cannot be sold in that state. Any help would be appreciated.
Oba-san
You could customize the Add to Cart based on the customer's address ...
However a few thoughts ...
You want to stop sales to a specific state ... is this based on billing or shipping?
Do you want to allow Grandma in Ohio, assume for the moment that is the state not allowed to have the product, be able to buy it, but ship it to little Tiny Tim in New York, assuming the block is on shipping address and New York is okay?
New Zenner
Thanks for your response. I would like not to allow shipping for 1 specific product to 1 specific state (CA).
Could you be more specific regarding customizing the add to cart button to accomplish this? Thanks in advance.
Ajeh:
You could customize the Add to Cart based on the customer's address ...
However a few thoughts ...
You want to stop sales to a specific state ... is this based on billing or shipping?
Do you want to allow Grandma in Ohio, assume for the moment that is the state not allowed to have the product, be able to buy it, but ship it to little Tiny Tim in New York, assuming the block is on shipping address and New York is okay?
Oba-san
If you just wanted to control this based on Add to Cart, the customer would have to be logged in and you would be checking their Primary Address ...
That means that someone from California could not add it to the cart and then ship it to New York as the "control" over the Add to Cart is happening too early ...
If you want to control it based on the shipping address, then anyone can add the Product to the cart but only when the shipping address is "not California" can they get past the shipping page ...
This lets someone in California ship the product to someone in New York ...
So you need to decide what kind of control do you want on the Product ...
1 at the Add to Cart stage
2 at the Checkout Shipping stage
It sounds like you want to stop the order at the checkout_shipping if the product is in the cart and if the customer has a California address ...
New Zenner
Ajeh:
If you just wanted to control this based on Add to Cart, the customer would have to be logged in and you would be checking their Primary Address ...
That means that someone from California could not add it to the cart and then ship it to New York as the "control" over the Add to Cart is happening too early ...
If you want to control it based on the shipping address, then anyone can add the Product to the cart but only when the shipping address is "not California" can they get past the shipping page ...
This lets someone in California ship the product to someone in New York ...
So you need to decide what kind of control do you want on the Product ...
1 at the Add to Cart stage
2 at the Checkout Shipping stage
It sounds like you want to stop the order at the checkout_shipping if the product is in the cart and if the customer has a California address ...
This ties in with the 48 states free shipping you already helped me with, but how can I block all orders from being shipped to the other two states based on option "2 at the Checkout Shipping stage"
Oba-san
If you have only the 48 states defined in your Zone for your shipping module(s) then the other 2 states cannot be shipped to ...
If for some reason you cannot take payments from those 2 states either, then add the same Zone to your Payment module(s) ...
New Zenner
Great. Thanks!
New Zenner
When I tried to do this, it just has fields for countries. What if I ship only to U.S. but I need to block shipping to a certain state? Where you put this in the zone module?
Ajeh:
If you have only the 48 states defined in your Zone for your shipping module(s) then the other 2 states cannot be shipped to ...
If for some reason you cannot take payments from those 2 states either, then add the same Zone to your Payment module(s) ...
Oba-san
Look in the Free Software Add Ons for Zone Table where you can define the Zone with the Zone Definitions ...
New Zenner
Ajeh:
Look in the Free Software Add Ons for Zone Table where you can define the Zone with the Zone Definitions ...
Are you referring to this? http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=695
I don't need shipping rates for any states I just need to block shipping to one state.
Oba-san
Then build a Zone Definition for your shipping module where you do ship to and add it to your shipping module(s) that you have installed ...
I thought you used Zone Rate zones ... shipping module ...
The Zones Table Rate for Multiple Zones works like Zones but works off of Zone Definitions which allow you to build Zone Definitions to the State level ...
New Zenner
Using Zones Table Rate for Multiple Zones will setup a Zone definition that I can enter states in?
Oba-san
That shipping module will allow you to build as many Zone Definitions as you want ...
Then install it, and you will see that you can set a seperate Table Rate based on Item Count, Price or Weight and select any of your existing Zone Definitions for it ...
So if you made a Zone Definition for:
Country: United States
Zone: Texas
That definition would work only for Texas ...
If you made a Zone Definition for:
Country: United States
Zone: Alaska
Country: United States
Zone: Hawaii
That definition would work for only Alaska and Hawaii
If you made a Zone Definition for the 48 states plus DC ... that Zone Definition would only work for the 48 States plus DC ...
If you made a Zone Definition for:
Country: United States
State: Ohio
Country: Canada
Zone: All Zones
That Zone Definition would work only for Ohio and all of Canada ...
etc. etc. etc.
Zen Follower
Ajeh:
That shipping module will allow you to build as many Zone Definitions as you want ...
Then install it, and you will see that you can set a seperate Table Rate based on Item Count, Price or Weight and select any of your existing Zone Definitions for it ...
So if you made a Zone Definition for:
Country: United States
Zone: TexasThat definition would work only for Texas ...
If you made a Zone Definition for:
Country: United States
Zone: AlaskaCountry: United States
Zone: HawaiiThat definition would work for only Alaska and Hawaii
If you made a Zone Definition for the 48 states plus DC ... that Zone Definition would only work for the 48 States plus DC ...
If you made a Zone Definition for:
Country: United States
State: OhioCountry: Canada
Zone: All ZonesThat Zone Definition would work only for Ohio and all of Canada ...
etc. etc. etc.
Bringing up an old thread for a relevant question: if only blocking state in the entire world (ie: CA) then it seems crazy to have to go to Zone Definitions and insert every single country>all zones and then United States>all zones except CA. I started it, but it's going to take forever to add all those zones! Isn't there a way to simply block one zone and allow all the others??
Oba-san
Create a Zone with:
INSERT INTO `geo_zones` (`geo_zone_id`, `geo_zone_name`, `geo_zone_description`, `last_modified`, `date_added`) VALUES (37, 'The World except California', 'The world except California', NULL, '2008-02-01 12:12:12');
INSERT INTO `zones_to_geo_zones` (`zone_country_id`, `zone_id`, `geo_zone_id`) VALUES (223, 1, 37), (223, 2, 37), (223, 4, 37), (223, 5, 37), (223, 12, 37), (223, 13, 37), (223, 14, 37), (223, 15, 37), (223, 16, 37), (223, 18, 37), (223, 19, 37), (223, 21, 37), (223, 22, 37), (223, 23, 37), (223, 24, 37), (223, 25, 37), (223, 26, 37), (223, 27, 37), (223, 28, 37), (223, 29, 37), (223, 31, 37), (223, 32, 37), (223, 33, 37), (223, 34, 37), (223, 35, 37), (223, 36, 37), (223, 37, 37), (223, 38, 37), (223, 39, 37), (223, 40, 37), (223, 41, 37), (223, 42, 37), (223, 43, 37), (223, 44, 37), (223, 45, 37), (223, 47, 37), (223, 48, 37), (223, 49, 37), (223, 51, 37), (223, 53, 37), (223, 54, 37), (223, 55, 37), (223, 56, 37), (223, 57, 37), (223, 58, 37), (223, 59, 37), (223, 61, 37), (223, 62, 37), (223, 63, 37), (223, 64, 37), (223, 65, 37);
Then use this:
INSERT INTO zones_to_geo_zones (zone_country_id, zone_id, geo_zone_id, date_added)
SELECT countries_id , 0, 37, CURDATE()
FROM countries
WHERE countries_iso_code_3 NOT IN ('USA');
Next, delete California ...
Now add the US Territories ...
I think that will build everything except California in the Zone ...
NOTE: I have not tested this but it should work ...
If not, we can try again tomorrow ... :lookaroun
Zen Follower
Ajeh:
Create a Zone with:
INSERT INTO geo_zones (geo_zone_id, geo_zone_name, geo_zone_description, last_modified, date_added) VALUES (37, 'The World except California', 'The world except California', NULL, '2008-02-01 12:12:12');
INSERT INTO zones_to_geo_zones (zone_country_id, zone_id, geo_zone_id) VALUES (223, 1, 37), (223, 2, 37), (223, 4, 37), (223, 5, 37), (223, 12, 37), (223, 13, 37), (223, 14, 37), (223, 15, 37), (223, 16, 37), (223, 18, 37), (223, 19, 37), (223, 21, 37), (223, 22, 37), (223, 23, 37), (223, 24, 37), (223, 25, 37), (223, 26, 37), (223, 27, 37), (223, 28, 37), (223, 29, 37), (223, 31, 37), (223, 32, 37), (223, 33, 37), (223, 34, 37), (223, 35, 37), (223, 36, 37), (223, 37, 37), (223, 38, 37), (223, 39, 37), (223, 40, 37), (223, 41, 37), (223, 42, 37), (223, 43, 37), (223, 44, 37), (223, 45, 37), (223, 47, 37), (223, 48, 37), (223, 49, 37), (223, 51, 37), (223, 53, 37), (223, 54, 37), (223, 55, 37), (223, 56, 37), (223, 57, 37), (223, 58, 37), (223, 59, 37), (223, 61, 37), (223, 62, 37), (223, 63, 37), (223, 64, 37), (223, 65, 37);
>
> Then use this:
> ```
INSERT INTO zones_to_geo_zones (zone_country_id, zone_id, geo_zone_id, date_added)
SELECT countries_id , 0, 37, CURDATE()
FROM countries
WHERE countries_iso_code_3 NOT IN ('USA');
Next, delete California ...
Now add the US Territories ...
I think that will build everything except California in the Zone ...
NOTE: I have not tested this but it should work ...
If not, we can try again tomorrow ... :lookaroun
That is awesome! I will do it and report back. Thanks as usual, Ajeh.
Tell staff why this post should be reviewed.