Home Forums Front-end Issues WC Vendors Pro Dashboard Frontend and Google Map Saving and Using Different Map


WC Vendors Pro Dashboard Frontend and Google Map Saving and Using Different Map

  • I am so close to fully get ACF Pro’s Google Map field working for WooCommerce with WC Vendors Pro (for multi-vendors) using Social MarketPlace theme. The following are now working:

    • Google Map is showing in the backend admin product edit page.
    • Google Map is showing in the simple product page.
    • Google Map is showing in the frontend vendor product edit page.

    The one challenge to overcome is when the address is updated and saved in the frontend, upon refreshing the backend, the addresses and map aren’t the same. Likewise, when updating the address in the backend, the frontend isn’t using the same map address for display.

    I believe the backend and the single product display page pulls the map data using product post_id 16279. However, the frontend saves and pulls data using a different post_id. T

    function wcv_add_acf_fields() {                                                                                                                                                       
            acf_form( array(                                                                                                                                                              
                    'field_groups' => array(1313),  // <== CHANGE to ACF field group for geolocation                                                                                      
                    'form' => false, // true = create new form element, false = use existing form element                                                                                 
                    'return' => '',                                                                                                                                                       
                    //'post_id' => false                                                                                                                                                  
                    //'post_id' => get_the_ID()                                                                                                                                           
                    //'post_id' => 'user_' .get_current_user_id()                                                                                                                         
                    //'post_id' => WCVendors_Pro_Vendor_Controller::get_vendor_store_id( get_current_user_id() )                                                                          
            ) );                                                                                                                                                                          
    add_action('wcv_before_product_type', 'wcv_add_acf_fields');                                                                                                                          
    add_action('wcvendors_settings_after_seller_info', 'wcv_add_acf_fields');      

    I’ve used different post_id values above. But none of them allows me to update and save to the same post id used in the backend.

    Here are the outpout of different post_id echoed from the template file for debugging:

    get_current_user_id(): post_id => user_19
    get_the_ID(): post_id => 646
    WCVendors_Pro_Vendor_Controller::get_vendor_store_id( get_current_user_id() ): post_id => // no output

    The script maybe is saving different addresses to different post_id.

    Backend: Admin / Product Edit Page
    The attached image below shows a product using post id 16279 below with an address saved.

    ACF Pro Backend

    Simple Product Display Page
    The single product display shows the same location below:

    Simple Product Listing

    WC Vendors Pro Dashboard Frontend
    If a different address was entered in WC Vendors Pro’s frontend Dashboard / Product Edit, then saved and refreshed, the new address is shown. However, that new address isn’t reflected in the backend. Changing the backend postal address and saved won’t show in the frontend after a refresh.

    WC Vendors Pro / Vendors Dashboard / Frontend / Product Edit

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.