WooCommerce shipping method duplication - wordpress

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.

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

How do I get order information from the woocommerce payment screen?

Hi i want to woocommerce checkout page get woocommerce-checkout-review-order-table.
How do I get all the information for that order? The important thing is to be sensitive to situations such as VAT, cargo. I just need information.
You can get all the details of the products you've added into cart on checkout page. Please check if you've added tax(VAT) and shipping (CARGO) class to each product from your WP admin.
Here you can refer WC tax rate docs and you can see here to assign products a tax classes.
Similarly, you supposed to create and assign shipping zones and it's rates as well. You can find docs for creating shipping zone from here
You can find many tutorials to set shipping for your desire requirements however, here is the one for quick reference. WooCommerce Shipping Methods
Hope this may help you in your requirements!
Be noted you can't get order information before you placed order successfully. I answer you based on understanding that your need information of tax, shipping cost on checkout page.

WooCommerce - Shipping plugin ignored

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.

Resources