The $havemeta
variable isn’t defined inside your shopping_location_text()
function, so it isn’t available for use there.
For a quick fix (or for testing/toying) you can move your code inside the function, like this:
add_action( 'woocommerce_before_main_content', 'shopping_location_text', 10 );
function shopping_location_text() {
global $current_user;
get_currentuserinfo(); // wordpress global variable to fetch logged in user info
$userID = $current_user->ID; // logged in user's ID
$havemeta = get_user_meta($userID, 'location_select', true); // stores the value of logged in user's meta data for 'location_select'.
//var_dump($havemeta);
if( is_shop() ) {
print '<p class="shopping-location-text">YOUR ARE CURRENTLY SHOPPING IN <span style="FONT-WEIGHT: 700;COLOR: #fa4516;">' . $havemeta . '</span></p>';
}
}
Related Posts:
- Get meta_query value by user meta array
- How to make an meta_query optional?
- Adding number to date not working [closed]
- Is it possible to retrieve all posts with a certain value for metadata?
- WP_Query: getting posts where custom field exists
- Usermeta data unserialize, extract and display in table in WordPress
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- WP_query meta_query slow with OR and DATES
- How to use something like meta_query but for fields?
- Too many if’s and else if’s ?? – Must be better way [closed]
- How to handle a custom form in wordpress to submit to another page?
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- How to use multiple query with same meta key
- Calling a method from functions.php on a click of a button
- How can i create a function to get youtube video time
- Getting movie and serial on actor page
- Match checkbox data with page title to show certain items
- Geocoding an Exploded Custom Field Array
- Modern Tribe Calendar wp-query with meta query not working at all
- Removing WordPress profile fields from non-admins
- Use ajax to update_post_meta
- Issue with foreach on duplicate meta_key’s
- How to display custom field on homepage
- Can an array be used as a meta_query value?
- WooCommerce: update custom fields after checkout validation failure
- List of posts by day of the week
- If Meta Checkbox is checked, do something?
- Show custom field if it exists, and show different elements if it doesn’t
- How to display user nickname (not display name) in PHP template?
- Custom field value not saving when it contains a URL?
- Sum custom field values of particular taxonomy
- tracking number field in Woocommerce order [closed]
- Sort posts by custom fields value using dropdown menu
- WP_Query Check if post has one or more attached medias
- How to upload a file to a folder named after the user_id via plugin
- Creating user status mode in WordPress
- Need Help Fixing My Iframes [closed]
- How to abort saving data in save_extra_profile_fields function WordPress?
- how to retrieve a value if a checkbox is checked
- Trouble checking if custom woocommerce checkout field is empty or not
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Add / Update Custom Fields After Select Pictures in Media Window
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- Remove the last X characters of a custom field value
- Grouping posts by a custom meta value
- Find a way to retrive data updated through metabox plugin to web page
- Read array in php?
- Why are the details of my todo not saving?
- Can’t save php string to a custom field
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Login redirect. Check user meta and redirect accordingly
- Adding Author Box Meta Links with Co-Authors
- Undefined offset: 0-wp-includes/meta.php:488 -Melding
- Get the users that my following users are following
- How do I remove duplicate users from two merged WP_User_Query objects?
- Conditional featured image with youtube thumbnail
- Add a counter for mouseovers (custom field)
- Show field if it has contents on Advanced Custom Fields
- the_meta – no get_the_meta query?
- Uses for function: wp_update_user
- Display additional user fields
- Create condition for Author bio Social Links
- Dynamically added custom fields not displayed on WooCommerce email notifications
- How to store checkbox data for individual users?
- How do I Populate a Table Field with User Meta Data?
- How can I add diffrent editable text fields?
- Add a “custom field” to a category that can be retrieved when viewing the category page with get_post_meta
- Include custom fields in search
- update_term_meta() only updating once on certain meta keys
- Trying to update Woocommerce meta values
- How to add and subtract user meta values after post meta update
- How to Call on WordPress Custom Fields without a Plugin
- Query on a repeater date (acf)
- Generating 3 random numbers and saving them in database
- ACF – Can’t get custom post type by taxonomy
- Save custom field on WP_List_Table
- Export WordPress User Meta to CSV/Excel
- Display current user metadata on WordPress page
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- custom fields anchor points php
- WooCommerce multiple custom fields code
- When working with a post, almost all wp_postmeta are deleted
- Filter loop by ‘price’ with meta_query
- What syntax is this? “{{post.price}}”
- Updating Lat and Lng of posts automatically gives sporadic results
- Creating a custom register form
- get_users when from meta key that has serialized values
- How to get the first letter from custom field?
- Meta box not saving spaces
- custom field meta-box with dropdown/autocomplete
- If Elseif Query
- How to use custom fields to replace top-level parent title with an image using wp_list_pages?
- Display custom meta box in my template file
- Query posts by custom fields (object post)
- Advanced Custom Fields Show PHP in Text Areas
- Grabbing value of input field inside of array
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress
- How do I organize posts based on their taxonomy?
- Shortcode Displays 2 times