Here is a screencast https://www.screencast.com/t/llJl5QZ8
When country is changed, only payment methods are updated (with ajax), but NOT shipping methods.
I have tried using additional javascript code to force triggering 'update_checkout' but no luck. The code I used was a manual call of jQuery(document.body).trigger('update_checkout') which only triggers payments update but not shipping methods.
Can someone shed a light on possible ways to debug & fix this problem?
Related
In my online store, there are sevral shipping methods. I added a plugin for distance delivery (Boxtal Connect)
I would like to be able to autorefresh total amount when a new shipping method is chose on the checkout page.
I think the selector is name=shipping_method[0] and the trigger is jQuery('body').trigger('update_checkout',
I would like to find an code to add on my child function.php to do it.
In fact it works well on the cart page and I think it is a native woocommerce function.
Thanks for you help
I'm currently working on a multi STRIPE checkout for different STRIPE accounts based on the shipping country.
So far everything works smoothly by using the wc_stripe_params, wc_stripe_payment_request_params and woocommerce_stripe_request_headers filters and overloading the respective classes for the webhooks. There is one problem though.
Upon checkout page load, where the payment methods are, STRIPE renders CDATA values for their JS files.
When the initial shipping country guess through geoip database was correct and the customer doesnt change the shipping country, everything works fine, since the correct public keys were inserted into the JS of STRIPE. When the customer changes the shipping country there is no way to manipulate the already processed JS variables. This is why I want to split up the checkout process so that the last page is just for payment options based upon the before selected shipping country.
I know that there are multiple plugins for multi-step checkout available, but all use ajax for a smooth rendering, which results in the same error. I understand the way how to customize different processes in WP or WC, but I don't know how to really tackle this one since the formon the checkout page is posted to the wc_get_checkout_url() which needs payments selected and done - it doesnt look like there is a real multi step without ajax planned?
Thanks in advance for any help or thoughts
Problem solved by splitting up the checkout process into multiple forms and posting the data as one to the woocommerce checkout controller
I just upgraded woocommerce from 2.3.10 to 3.2.6
I had legacy flat rate and free shipping methods before, and I created a new shipping zone and then added the shipping methods to this zone.
Of course, I disabled the legacy shipping methods, so it is not showing in the shipping tab.
On the front-end, everything looks working well.
My problem is on the back-end.
I have a custom cart on the backend, it uses WC()->shipping->load_shipping_methods($package) to get shipping methods and calculate shipping costs.
I need only one flat-rate but it is showing more than one.
I saw flat-rate, flat-rate:3 and flat-rate:5 through error log.
How can I get what I want? Any help would be much appreciated! Thank you.
'woocommerce_payment_complete' is the hook that is triggered when payment is flagged as accepted by your payment gateway in WooCommerce.
It's a really useful hook because you can make things happen as soon as payment passes.
The problem I'm having it testing custom functions I attach to the hook - it is extremely laborious.
Basically, every time I want to test one of my functions attached to this hook I have to fill up my card, go through check out, submit payment then analyse what happens. If there's a bug or error then I have to fill up my card, go through check out, submit payment then analyse what happens all over again.
I'm losing hours doing this, so I was wondering, does anyone have a dev tip to make this less time consuming?
This hook is fired after the steps which (may) include financial transactions. Testing its contents does not actually require a financial transaction, but your wordpress does have to step through shopping cart events, in order to get you to the later point where the hook is fired.
What I did was to create a 100% discount coupon, so that I do not need to bother with
financial transactions when I modify/test code involved in this hook. That way I can quickly buy something from my shopping cart and then watch my logs output messages telling me about the code that is called when this hook is called, after the shop code has done its thing.
I've written a plugin that adds a custom shipping method to WooCoomerce.
It seems to be intermittently NOT returning shipping prices.
On the cart page, the shipping estimator works fine; then, when you click through to checkout, it will INITIALLY display all the results (from cheapest to fastest) but on refresh, with correct GUEST billing address, it returns nothing; debugging shows that it does not even call the plugins' shipping calculator or 'enabled' function check. It just says that there are no shipping options for Australia (if this is the only shipping option activated)
Have tried contacting the Woo guys, but nada.
EDIT:
Lessons learned.
Firstly, the big one: WooCommerce uses transients - it caches your shipping results. You can reset these in WooCoomerce settings, system status->tools Extra edit: Lastest WooCommerce version lets you turn this off! .. But only if you are shopping as administrator ..
Secondly: Once the above was out of the way, it simply turned out that I was reading in the posted address details incorrectly, and my plugin was returning 'false' and knocking itself out of the running. Big thanks to xDebug and PHP Storm ..
Thirdly: As an aside, I have also hooked the plugin's instantiation to the woocommerce_shipping_init, as Woo NOW recommends. Check out their revised docs at the shipping method API page
You should at least show us your code :-)
I bet there is something related to shipping address that is removing the shipping options.
If the initial page loads fine, but when address info is updated it doesn't respond correctly it may be a javascript issue. I'm working on a custom shipping plugin right now myself, and when any shipping details are changed it fires an event that updates the shipping results through AJAX. Posting a link to the checkout page, or looking for javascript errors on the front end might be very helpful.