Hi! I have not yet developed any hook to show a country select field in front-end, it’s in my to-do list.
Ok, thanks for your response and your excellent work so far! Would be great if you could implement this…
Hi! A country selector is would be great. Plugin is extremely good and I just need a country selector box on header.
I tried to make that but I fail π I can listed the countries bu how can I change the country value?
<?php $connn = WC()->countries->countries; ?>
<select name=”woo_countries”>
<?php foreach ($connn as $c):
echo ‘<option value=”‘.key($connn).'”>’.$c.'</option>’;
endforeach;
?>
</select>
Hi again, I’m still waiting for hear good news about country selector.
Hi, i have plenty of work and i don’t have time to develop this and another updates of my tasks list. I hope to do in the coming weeks.
Thanks.
Hi,
Firstly, great plugin oscargare. I developed a country selector which you can find here: https://strikt.ca
What I am missing, is that customer object should be set as PUBLIC. I want to alter it but there is no way because you set it to protected. Please include that in next version. WC also included customer object as public. I want to be able to do something like this:
$GLOBALS['wcpbc_frontend']->customer->set_country('NEW_COUNTRY');
Hi! It’s a very good job.
I updated the Development Version. This version include a action hook in class wcpbc-frontend which load a template with a country select.
You can replicate this template in your theme directory: Create a directory name “woocommerce-product-price-based-on-countries” and include country-selector.php file.
Download the development version and test.
Thank you!
Hi! version 1.3.0 includes a hook and a template to add a country selector.
Thanks, good job oscargare!
Only thing, you should change protected $customer to public $customer in order to allow advanced customization.
Hello Oscar!
It’s a great plugin! Thank you for this plugin.
How can I get the template to add a country selector? I mean, is this already setup through dashboard or I need to modify manually the code? I use the newest version of the plugin.
Thank you.
Great plugin!!!
I also just downloaded the latest version, and didn’t get the hook to get the country selector.
Please help.
And thanks again!!!
There’s a short description in the “Installation” tab of the plugin:
Country Selector (optional)
Add action “wcpbc_manual_country_selector” to your theme.
To customize the country selector:
Create a directory named “woocommerce-product-price-based-on-countries” in your theme directory. Copy to the directory created avobe the file “country-selector.php” included in the plugin. Work with this file.
Hope that helps.
@Sonnecschauer
I am not a developer, so I don’t really understand the steps, especially on add action and the country-selector.php. Is .php will automatically show or we need to put them on header.php (since I want to show the selector on header).
Thank you.
Just put this line in the appropriate file, e.g. header.php
<?php do_action('wcpbc_manual_country_selector'); ?>