• Hi supporters,
    I Want to display products by its 25 location to 25 separate pages. I use WCFM as my multivendor plugin.

    There are 25 States. AND I want to take PRODUCTS according to those 25 states and display them in separate 25 pages. (Because i want to link those 25 pages to different 25 buttons with state location names.)
    Can i have a custom code for this with a shortcode please?

    Thank you in advance

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Eyal Fitoussi

    (@ninjew)

    @shenalorlof,

    You can use the script below for this task.

    The script will look for the state value in the URL. You will need to use the “state” URL parameter when you create your links to the page with the form.

    for example: https://www.yoursite.com/?state=florida

    The only thing you need to change in the script is the value 1 in

    
    if ( 1 !== absint( $gmw['ID'] ) ) {
    

    to the actual ID of your GEO my WP form.

    
    function gmw_cusotm_filter_locations_by_state( $gmw ) {
    
    	// Change 1 to the ID of your GEO my WP's form.
    	if ( 1 !== absint( $gmw['ID'] ) ) {
    		return $gmw;
    	}
    
    	// Make sure state passes via URL.
    	if ( empty( $_GET['state'] ) ) {
    		return $gmw;
    	}
    
    	$gmw['page_load_results']['state_filter'] = $_GET['state'];
    
    	return $gmw;
    }
    add_filter( 'gmw_default_form_values', 'gmw_cusotm_filter_locations_by_state', 50 );
    

    I hope this helps.

    Thread Starter shenalorlof

    (@shenalorlof)

    Hello @ninjew hope you are fine in this pandemic situation
    First i want to thank you for your excellent service.. I have a Two questions please..

    01) How can i find the form id which comes by default in WCFM add new product page
    1. https://ibb.co/b6wPgDw
    2. https://ibb.co/WtSMrXq

    This came when i activate the plugin i didn’t add any new form to this..

    02) i added a new page with state in the url parameter. hope i did this correct
    1. https://ibb.co/gR1g79Z

    Thank you, hope to hear from you soon.

    • This reply was modified 3 years, 7 months ago by shenalorlof.
    Plugin Author Eyal Fitoussi

    (@ninjew)

    @shenalorlof,

    That is not the search form I am referring to. What you have in the screenshots is the Location form.

    You need to create a search form using GEO my WP’s forms builder ( dashboard -> GEO my WP -> Forms ) then place it on a page of your site using its shortcode.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display products by location in seperate pages’ is closed to new replies.