Home › Forums › Front-end Issues › 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:
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.
Simple Product Display Page
The single product display shows the same location below:
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.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc
— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.