I would like to alter the default nation on the cart web page to none, i.e. to have “Choose a rustic…” seem because the default within the drop-down record of nations.
I’ve checked out this WooCommerce Docs snippet which makes use of the default_checkout_country
filter but it surely solely appears to use to the checkout web page (and never the cart web page), as its title says. I additionally examined this by surrounding the apply_filters('default_checkout_country', ...
within the recordsdata the place they seem with echo
statements and so they do not seem wherever within the generated markup for the cart web page.
As we’re utilizing PayPal Specific Checkout we do not use the WooCommerce built-in checkout web page so it seems that the above talked about snippet would not apply and one other resolution is required.
My subsequent step was to look into woocommerce/templates/cart/shipping-calculator.php
the place the nation choice record is generated on the cart web page. There is a name to $woocommerce->customer->get_shipping_country()
. That perform in woocommerce/lessons/class-wc-customer.php
merely picks up the $_SESSION['customer']['shipping_country']
variables. The one place these variables are set is within the perform set_shipping_to_base()
in the identical file and the one place that perform is (conditionally) known as is in woocommerce/shortcodes/shortcode-cart.php
which I assume generates the cart from the shortcode used on the autogenerated cart web page. I added a echo
assertion to the block in that file the place that perform is known as however nothing appeared within the markup, so I obtained caught there.
The above investigation appears nevertheless to be considerably of a purple herring because the above talked about session variables appear to truly be set by the Base Nation/Area setting on the Normal tab, as it might differ accordingly when the $_SESSION
variable obtained printed in a browser the place cookies and cache had been beforehand deleted. So I am sort of caught right here too. I would just like the Base Nation/Area setting to stay the nation set, however nonetheless haven’t any default nation until the customer really has chosen it.
Any concepts?