WooCommerce - Shipping plugin ignored - wordpress

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.

Related

WooCommerce updating the shipping method depending on the shipping choice field changes

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

WooCommerce - Paypal Amount Error after shipping costs discount

Good morning.
Thanks to the code provided here WooCommerce - get shipping country for non registered user I managed to add the correct discount to my checkout.
A brief resume: I had to discount the full shipping cost in case the order comes from specific country. But I cannot use the standard free shipping procedure, because I have to know the amount of the shipping costs to use it somewere after the checkout. That's why I added the some code to apply a negative fee to the woocommerce_cart_calculate_fees hook.
When I try to pay via PayPal I receive this error "https://www.paypal.com/webapps/shoppingcart/error?flowlogging_id=IDd&code=AMOUNT_ERROR&mfid=MFID"
I believe that PayPal does not evaluate the new total amount.
I tried to echo the $cart->total value inside woocommerce_after_calculate_totals hook, and it's OK.
So Paypal is looking at another value...
What can I do?
This is what I get (sorry for the partial translation)
Thanks!
PayPal evaluates what you send it -- so, review a log of what your browser is actually sending in the request. Use the Dev Tools 'Network' tab.
And try the latest PayPal for WooCommerce plugin, which has an option to enable Smart Buttons that use an API instead of redirecting with the amount, among other things: https://woocommerce.com/products/woocommerce-gateway-paypal-checkout/

WooCommerce Multi-Step Checkout (Billing/Shipping Address and Payment Methods on different pages)

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

WooCommerce shipping method duplication

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.

How to configure multiple address in woocommerce

I am using woocommerce in my e commerce website. I want my customers to be able to save multiple shipping and billing addresses. The addresses can be viewed and edited from my account page. In the checkout page they should be able to select one of the addresses they have already saved.
I have googled a lot and found absolutely nothing but a plugin which does not serve the purpose. I went through the woocommerce documentation but not able to figure out. I am actually overwhelmed by it and feeling lost.
Please help me guys and at least point me somewhere. This is a very common feature in a lots of website nowadays and i am sure it can be done.
In default, as you know WooCommerce only allow one billing & shipping address. But using custom code or plugins, you can achieve this feature in WooCommerce.
Writing code snippet is little difficult as per your question. But if I need the tweaks you mentioned, my approach will be given below.
Edit Checkout form with option to insert new address / select a address from saved list.
Create option in My Account page to insert new address.
Save the new user data in user meta.
If you are looking for a plugin, I would like to suggest WooCommerce Multiple Addresses Pro plugin which allows your customers to save multiple shipping and billing addresses to their My Account page.
Also the newly added addresses will be available in My Account page of the online store, from where the shopper can add, edit or remove addresses.
Moreover, the shopper can set the addresses as default, billing and shipping separately.I think this plugin will be best solution for your demands.
You might try to use this plugin: Woocommerce Multiple Addresses
If you have the Shipping Multiple Addresses plugin, add [woocommerce_select_multiple_addresses] to the checkout page.
It is working perfect.First i'm going to buy http://www.woothemes.com/products/shipping-multiple-addresses/ this plugging but this plugging save my money.

Resources