This is the oficial documentation of Woocommerce Shipping Price by Place, this plugin is a shipping method where you can specify the cities of the región and give a different price for each location. This price is updated when you choose a location.

 

Remember: You can send an email in English or Spanish to support@letsgodev.com and the answer will be in less than 72 hours

 

Indice

  • Requeriments
  • Install/Activate Plugin
  • Setting Page
  • In the Checkout Page
  • Filters
  • FAQ

 

Requirements

    • Woocommerce 2.6.x
    • Woocommerce 3.0.x

 

Install/Activate Plugin

Go to : Plugins > Add New

install_plugin1

 

Go to : Upload Plugin

install_plugin2

 

Search the plugin in your PC

install_plugin3

 

Then, click on “activate” and could see the plugin in the list of activated.

 

Shipping Price by Place 1

 

Activate the plugin with you License code

Please go to : https://www.letsgodev.com/documentation/how-to-activate-deactivate-my-license-code/

 

Settings Page

For customizer the plugin first you must assign it to a zone, then got to:

Woocommerce > Settings >Shipping

 

 

 

 

 

Once created the Shipping Zone, we add the Shipping methods that we want, doing click en the sign plus.

 

Shipping Price by Place

 

Will appear a modal with the options of plugin. For view all the options of plugin, you must do click in “View the rest of the configuration“.

 

 

Ok, we will explain each option of this panel.

 

 

 

    • Method Title: This is the name will appear in the order view
    • Select2 Library: This library JQuery gives you a customizable select box with support for searching
    • Required Field: If you uncheck this options, the field with the localizations wont be required.
    • Label First Level: It is the name of the first level. For example: Counties, Province, etc
    • Label Second Level: It is the name of the second level. For example: Townships, Districts, etc

 

 

In the same Setting Page, you can add the prices of each place.

 

Manual

v202_pic4

 

 

Click in “Add Place”, will appear a new row where you can choose the country and the state, type the name of first level, the name of second level and finally, the price. You can put all the locations you want.

Too, you can specify the price for default for other cases

 

Import File

Or you can import a CSV/TXT file with the zones and prices.

In this section, you can choose if it apply utf8 or not when it upload. And too, you can download the last CSV that you uploaded.

 

Important: always you must put zone1 and zone2 (for example: Counties and Townships) 

 

If the country has states, you must put in the CSV:

US:CA,Zone1,Zone5,5
US:CA,Zone1,Zone6,7

This case is United State:California.

 

If  the country has not states, you must  put in the CSV:

CO:,Zone1,Zone5,1000
CO:,Zone1,Zone6,2000

This case is Colombia, in Woocommerce it has not states.

 

In the checkout page

When the buyer change the state, the plugin will bring all the locations of state selected. Will appear a dropdown bellow. This field will be “required”.

 

screen5

 

 

This dropdown is updated each time the state or country is changed. Once a location is selected, the order view is updated.

 

plugin_gowooship7

 

When the purchase is ready, the email show the detail of shipping.

 

plugin_gowooship8

screen6

Filters

There are some filters that can help customize the plugin, especially if we have some complex business rules.

 

Remember: now the filters has the code instance in his hook name.

 

Method Available

If you need change the conditions for the plugin is available or not, you can use the filter:

<?php add_filter("woocommerce_shipping_gowoo_shiplace_{instance_id}_is_available",{function_name},10,2); ?>

 

For example:

Explanation: if the day is 30, then the plugin is not available otherwise, it will be available.

 

Remember : the variable $package has all the information of order, the products, their characteristics, etc

 

Bussines Rules

If you need to apply some rules to the shipping price calculated by the plugin, you can use this hook

<?php add_filter('woocommerce_shipping_gowoo_shiplace_{instance_id}_calculate',{name_funcion},10,2); ?>

 

For example:

Explanation: if the total price is lower then 100, we add the 20% to the shipping price, otherwise I do nothing.

 

$data is a array that contains all the calculate values of plugin, and you can modify with this hook.

 

$data[‘found’] ‘in list’: if the zone that you choise was found, ‘default’: if the zone was not found then it put the price for default, ‘not found’: if you isn’t at checkout page
$data[‘label’] Is the message that will appears in the front
$data[‘level1’] Is the zone1 name that the user choise
$data[‘level2’] Is the zone2 name that the user choise
$data[‘level2_key’] Is the zone2 key that the user choise
$data[‘price’] Is the price of the zone2

 

 

FAQ

1. How to remove the state field?

In you functions.php put this code:

or you can use the plugin Checkout Field Editor.

 

 

2. How can I know my instance id ?

In the Setting data of the plugin, the url contain the code of instance.

 

Shipping price by place

 

 

3. How to add or remove Payment using this plugin ?

Exists a hook call “woocommerce_available_payment_gateways” of Woocommerce. For this example we remove the COD payment when the user choises a place with ID = 2

 

 

More Information.

4 tips of the plugin Woocommerce Shipping Price by Place

 

To see the demo, first you need simulate a purchase, you’re finally going to “checkout” and you will would see the demo.