I have same issue, but need to set country to US, here is how I fix it:
add_action('woocommerce_add_to_cart' , 'set_country_befor_cart_page');
function set_country_befor_cart_page(){
WC()->customer->set_billing_country('US');
WC()->customer->set_shipping_country('US');
}
Hope it will help.
Related Posts:
- Find out what is using PHP sessions in WordPress
- SESSION in WordPress Plugin Development
- Woocommerce cart is a non-object inside `admin_post` action [closed]
- WordPress Keeps Logging Out – What Tests Can I Run to Solve This?
- User Session and Stored Cookies not get removed
- Session destroyed on page redirect
- Turning on output buffering in a wordpress plugin
- WooCommerce – set session with new cart item meta when updating cart item quantity [closed]
- How do I add $_SESSION[”] to my wordpress page?
- how do i change my website facebook login button to another text immediately user login? [closed]
- Codeless random token generation to pass into multiple tracking links in a single page load
- Strange admin-ajax / CSS / $_SESSION issue
- Plugin or ways to limit number of users logging in the website,
- Using sessions or an alternative in a plugin
- after logout session not destroy from server/website side
- Can’t redirect to previous page after using GET
- Session alternative for plugins (due to caching)
- Using a Cron Job to dynamically populate a field ONCE, and then making the field blank the next time someone visits page
- PHP $_session is not work in wordpress
- Execute js files doesn’t seem to work
- options creation for plugins
- Users are being redirected to main site when trying to register on subsite of my Multisite network
- Slider/text combination plugin
- How to disable a widget when dependent plugin is inactive?
- How can i force wp-admin to use 2-column dashboard layout? [closed]
- First plugin, problem with get_pages
- Is this a plug-in in wordpress or a custom JavaScript
- eLearning Module
- Are there action hooks for comments?
- How to automatically redirect to custom admin menu after plugin activation?
- Readable titles in mobile
- adding Adsense’s In-Article Ads between images of blog post
- Export postmeta (custom fields)
- Customizing a blog page layout
- Sub Plugin deactivation when Parent Plugin deactivate
- Convert to shortcode?
- Add logo to admin menu in my plugin
- what is the point of telling add_filter how many parameters you want passed to the function?
- Load CSS files in header of Bones theme?
- Trying to get property of non-object wordpress error message
- Advertising: Every page refresh counts as 3 ad impressions
- Google Maps with categories
- Trying to extend a plugin’s functionality
- WordPress Cache delete on plugin uninstall
- How to create repeater field manually, without plugin (ACF Pro)?
- Should I use the action in the plugin’s main file?
- Woocommerce checkout page broken when set as a checkout in woocommerce settings [closed]
- Jquery POST Ajax Return null data in wordpress
- How to get specific column data conditionally in database in WordPress?
- WpForms email notification displays the shortcode as variable instead of value
- How to create a folder in wordpress that will contain pages?
- Ajax Call not Working in Plugin
- Ayuda con este error: Failed to load plugin url: https://degranero.es/wp-content/plugins/easy-columns/tinymce/langs/es.js
- Store GravityForm data in phpmyadmin (mysql)
- How to remove WordPress Default Comment? not Facebook
- Try to debug a plug-in written by someone else
- Call function with button and return response
- Notice: unserialize(): Error at offset 0 of 1 bytes in plugin Accordion on WordPress
- updraft plus migrator problem [duplicate]
- plugin operation launch every time i click on page
- Can I retain custom taxonomy data when uninstalling a third-party plugin that created it?
- Plug-In’s Selection Not Accessible
- How can I customize Easy Appointment plugin?
- how to add custom css at top above all css file for specific url
- Related post based on 2 categories
- Include post_date in search
- Coming soon pages with rest of site in maintenance mode
- How to markup wordpress site using Schema.org?
- Plugin loaded, but not running
- Merge custom plugins in one folder
- Execute certain function on GET request
- White screen and can’t activate themes and plugins
- date function not correctly returning date
- Password Protected Directory Link Shows Maintenance Mode Page
- How do I increase the 255 character limit on the ‘description’ field for link library links?
- Dynamic price product
- Convert usernames listed by the Groups plugin shortcode to displayed names?
- Undefined variable _POST
- Display Facebook photo albums and photo comments?
- custom registration form [duplicate]
- I want to remove the register/login WordPress top bar from my website
- (Plugin) Icon needed beside the post title [closed]
- To generate Flickr Gallery in my wordpress site which plugin to use [closed]
- How to create load more button without a plugin?
- Detect if you’re in the “Frontend Editor” mode in Visual Composer WordPress [closed]
- Place a widget side by side rather than on top of each other
- How to create a nameplate extension? [closed]
- WP asking for ftp credentials when deleting plugin
- How can I view the responses of contact forms on different sites in one panel or elsewhere? [duplicate]
- Page with redirect
- How to add a simple design in classic editor plugin creating post page through another Wp plugin
- How to fix Fatal error: Cannot redeclare get_cli_args() in class-wp-importer.php
- Is there any performance difference between duplicating composer packages among multiple plugins and not doing it? How can I avoid it?
- Why is my Gutenberg block not saving and rendering the chessboard?
- Is it possible to use Classes between WordPress plugins with separate namespaces?
- Function to consider a plugin activated for selected users only
- unlimited chat rooms/channels/groups
- Content being rendered as empty string in posts endpoint
- WordPress Global Var in Plugin but Outside Function
- Call to undefined function create_function() – PHP 8.2