WooCommerce Product Edit Permission

And the Persian Mathematician.

Removal of the option to edit some fields for specific user role (update the fields and the user role):

add_action( 'add_meta_boxes_product', 'condless_remove_metaboxes_edit_product', 9999 );
function condless_remove_metaboxes_edit_product() {
	if ( ! current_user_can( 'manage_options' ) ) {
		remove_meta_box( 'postexcerpt', 'product', 'normal' );
		remove_meta_box( 'postimagediv', 'product', 'side' );
		remove_meta_box( 'woocommerce-product-images', 'product', 'side' );

add_filter( 'woocommerce_product_data_tabs', 'condless_remove_tabs' );
function condless_remove_tabs( $tabs ) {
	if ( ! current_user_can( 'manage_options' ) ) {
		unset( $tabs['advanced'] );
	return( $tabs );

As you probably have noticed- the source of the numbering system is India, the West was exposed to the method only in the 11th century, and mainly through the writings of the Persian Mathematician al-Khwarizmi, which the term “algorithm” was named after him.


Advanced Options for WooCommerce

Install the plugin to add advanced options to WooCommerce.


Cities Shipping Zones for WooCommerce

Install the plugin to add an option to select cities inside shipping zones, for example to be able to set different prices per city.

Cities List

How to modify cities names?
Update countries codes, and cities codes and names:

add_filter( 'woocommerce_states', 'csz_modify_woocommerce_states', 40 );
function csz_modify_woocommerce_states( $states ) {
	$states[ 'AT' ]['AT90001'] = 'Vienna';
	return $states;

How to remove some cities from the list?
Update cities codes:

add_filter( 'woocommerce_states', 'csz_remove_woocommerce_states', 50 );
function csz_remove_woocommerce_states( $states ) {
	$unnecessary_cities = array( 'AT10101', 'AT10201', 'AT10301' );
	foreach ( $unnecessary_cities as $city ) {
		unset( $states[ substr( $city, 0, 2 ) ][ $city ] );
	return $states;

How to keep only specific cities in the list?
Update country code and cities codes:

add_filter( 'woocommerce_states', 'csz_set_woocommerce_states', 20 );
function csz_set_woocommerce_states( $states ) {
	$country = 'AT';
	$cities = array( 'AT10101', 'AT10201', 'AT10301' );
	$new_states = array();
	foreach ( $cities as $city ) {
		if ( isset( $states[ $country ][ $city ] ) ) {
			$new_states[ $city ] = $states[ $country ][ $city ];
	$states[ $country ] = $new_states;
	return $states;

How to create shipping zones for quarters inside a city?
Create shipping zone with that city and restrict to the relevant postcodes, or (what is less recommended) split the city into areas (update city code and areas names) and in case the store is located iside the city update the store location in WooCommerce settings:

add_filter( 'woocommerce_states', 'csz_split_woocommerce_states', 30 );
function csz_split_woocommerce_states( $states ) {
	$city_code = 'AT90001';
	$sub_cities = array( __( 'Northern', 'woocommerce' ), __( 'Southern', 'woocommerce' ) );
	$count = 101;
	foreach ( $sub_cities as $sub_city ) {
		$states[ substr( $city_code, 0, 2 ) ][ $city_code . $count ] = $states[ substr( $city_code, 0, 2 ) ][ $city_code ] . ' - ' . $sub_city;
	unset( $states[ substr( $city_code, 0, 2 ) ][ $city_code ] );
	return $states;

How to create cities list for unsupported country?
By its Local Census/UNLOCODE/HASC geocoded administrative divisions, cities names must be unique and without punctuation.

Which additional uses shop owners make with the customer city?
Displaying certain products (filter by city category), selling certain products (plugin that limits by state), shipping certain products (associating the products to a class without price in the relevant shipping method), applying taxes (using the city code in the state field in the settings), enabling payment / shipping methods (conditional payment / shipping plugin).

Distance Fee

How to add distance fee?
Given a (domestic) city’s distances list, will be possible to add distance based fee for the shipping rate or product price (for example- to sell moving services).

Why the tax is not calculated on the distance fee?
Enter in the shipping method cost greater than zero.

Where the configured product distance fee will be displayed?
The product the fee will be added to its price and will be displayed in the subtotal of the mini cart widget.

How I shall organize the distances list for some city?
Use as index the locations codes or names (as they appear in the dashboard and update $key_format), verify to set distance to the city itself.

Bulk Edit Tool

What is the required format?
Semicolon (;) between each city. For example: Wien; Rust; Steinbrunn

How to Modify cities in list to the required format?
Replace [\r\n]+ (regex) with ; in Notepad++.

How to enter all the locations within certain distance from a city with distances list?
Enter exclamation mark (!) followed by the city code, if necessary add minium and maximum distance seperated by semicolon (;).

  • Plugin Settings: Remove the countries.
  • WooCommerce Shipping Zones settings: Remove the locations.
  • Plugins: Deactivate and delete the plugin.
  • WooCommerce Settings: Update the store location.
  • Database: Consider to convert/erase the state field values of orders and users that were created/updated while the plugin was applied on the countries they belong to.

WooCommerce Sell Media

And The University of the People.

Sell access to digital media (content pages, video courses, images, music):

  • Follow the guide
  • Add in the product’s “Purchase note” field link to the page the media embedded in
  • Enable content protection with the plugin
  • In case the media is stored in the website’s media folder prevent direct access to it, disable directory listing and hotlinking with the plugin
  • Limit connection to only one device with the plugin
  • Activate Two-factor authentication

As you probably have noticed- distance learning occupies a growing part of the way of learning, the one that has taken it one step further, is the University of the People, which does not have a physical campus and offers a full online degree without tuition.