Search code examples
phpwordpresswoocommercecart

Woocommerce shipping use case


I have a use case for a website and I can't figure out how to configure WooCommerce Shipping to do what I want.

Regarding shipping in that store:

  • There are products that can be delivered ONLY locally (for free). If someone is outside a defined the area, a message should notify him that this is a only local product.
  • Other products can be delivered locally (for free) or to outside areas.
  • Within these products that can be delivered to outside areas, different delivery rates apply (Product A is +$25 , but Product B is +$30, and Product C is +$10...)

I set up two Shipping zones:

  • Local (only a list of Zip codes) -> Free Rate,
  • Outside Area (everywhere) -> put a bunch of classes such as +10 , +20 , +25 ... and gave them rates

I have 2 main problems here:

  1. I dont know how to force some products to be local ONLY.
  2. when doing the setup above, the products that are on the outside area for which I gave a shipping class are not showing in local if someone is trying to checkout from a local Zip code.

How can this be solved?


Solution

  • These is somewhat debatable but you don't need to code to get this done. As I think you're already there.

    I set up two Shipping zones:

    Local (only a list of Zip codes) -> Free Rate, Outside Area (everywhere) -> put a bunch of classes such as +10 , +20 , +25 ... and gave them rates

    In your Local and Everywhere should have same shipping classes but should have different values.

    Let us say that in your settings be like this

    Shipping Zone > Local

    Zone regions: add list of zip codes or region.
    Shipping methods: add a Flat Rate method

    Flat Rate settings:
    reigelgallarde.me

    Shipping Zone > Everywhere

    Zone regions: add list of zip codes or region or leave it blank.
    Shipping methods: add a Flat Rate method

    Flat Rate settings:
    reigelgallarde.me

    I have 2 main problems here:

    1. I dont know how to force some products to be local ONLY.
    2. when doing the setup above, the products that are on the outside area for which I gave a shipping class are not showing in local if someone is trying to checkout from a local Zip code.
    1. You don't. Just add the correct shipping class for the product and the shipping will do it itself.
    2. This is where you lost me. Here's a screenshot of my cart. Local vs Everywhere.

    Local
    reigelgallarde.me

    Everywhere
    reigelgallarde.me

    Above two images are demonstrating a product that has a "Class A" shipping class.