Support » Plugin: States, Cities, and Places for WooCommerce » Remove certain places

  • Resolved sotnas

    (@sotnas)


    Hi,

    and congrats for the excelent plugin.

    I need disable some specific places, how is the hook for?

    Something like this?

    
    function scpwoo_remove_places_of_xx($places) {  //xx is the state ?
    }
    

    Ex:
    Need remove the place

    Country code = PT

    State code = PO

    Places = Amarante, Gondomar

    Thank you

    • This topic was modified 8 months, 2 weeks ago by sotnas.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Yordan Soares

    (@yordansoares)

    Hello @sotnas,

    Try adding this code snippet to the functions.php file of your current child theme, a custom functions plugin or using the Code Snippets plugin:

    
    /**
     * Remove places from the District of Porto
     */ 
    add_filter('scpwoo_custom_places_pt', 'scpwoo_remove_places_porto');
    function scpwoo_remove_places_porto( $places ){  
      global $places;
    
      unset($places['PT']['PO'][0]); //Amarante
      unset($places['PT']['PO'][3]); //Gondomar
    	
      return $places['PT'];
    }
    

    The [0] and [3] above, after $places['PT']['PO'], corresponds to the position of the districts (counting starts from 0). See Municipalities of Porto.

    Let me know if it works!

    Thread Starter sotnas

    (@sotnas)

    Hi Yordan

    Works fine!

    thank ou so mutch

    Plugin Author Yordan Soares

    (@yordansoares)

    I’m glad to know it worked!

    If you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

    Thread Starter sotnas

    (@sotnas)

    Review with five stars done!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove certain places’ is closed to new replies.