Closed jonkristian closed 2 years ago
I am sorry, but I am not sure which "ship to different address checkbox" you're referring to, since we do not have a checkbox with this purpose in KCO. Are you perhaps mistaking Klarna Payments ("KP") which has this checkbox on the checkout page with KCO?
I've linked the demo store for the two plugins so that you can verify which plugin you might mean.
I am closing this issue due to inactivity. If you wish to reopen it, please reply with an answer to my question.
Sorry for the late reply, please consider re-opening this, it is in regards to KCO and not KP.
The ship to different address checkbox is core woocommerce and it appears on the checkout page when active and when ticked the shipping address fields appears. However when it should not be active it is just hidden, but your code does not check for that, so it ticks it anyway and with empty shipping address fields (because they are hidden) it will effectively block the checkout process.
Description of the issue
The ship to different address checkbox is selected, but the shipping fields doesn't come up.
The result is that the box "Ship to different address" is checked and more important the shipping fields in some cases does not come up, you have to un-tick and re-tick the box, making the customer unable to checkout.
Expected behavior
Plugin should respect filter, if it is unset or not, and also adhere to the expected behavior that is defined by WooCommerce.
The expected behavior is that when:
"Sell to specific countries" is defined with a country and "Shipping location" is set to "Ship to all countries you sell to" or The following filter is used:
add_filter('woocommerce_ship_to_different_address_checked', '__return_false');
or 'kco' is unset on checkout.The checkbox on checkout should be unchecked, or left alone by the plugin.
Actual behavior
No matter what is done in WooCommerce settings or via a filter the checkbox is checked, and shipping fields aren't visible unless you uncheck/check it again.
This is a bit more complicated issue, because in some instances we unset 'kco' because of some certain product rules, but the following code doesn't actually seem to affect your js (PS: Stripped down for clarity):
(Maybe more code is needed to unset klarna on checkout?)
I can see in your js that you check the ship-to-different-address-checkbox but without regards to what is defined in woo or if the gateway is unset.
Klarna plugin version
Klarna Checkout - 2.7.3
WordPress version
WordPress - 5.9.2
WooCommerce version
WooCommerce - 6.3.1