Reset woocommerce orders to 0 - woocommerce

Does anyone know how to reset order systems so order ids start from 0 again?
I have tried to delete all orders from woocommerce but new orders start from last one again?
Thanks

My problem was solved by using the plugin Custom Order Numbers for WooCommerce.
You need to delete all orders and leave only one order.
Now go into WooCommerce settings, you'll find a tab Custom Order Numbers.
Here input your desired custom order in Sequential: Next order number.
After, click on Save Changes.
Now click on Remunerate Order tool.
Now click for confirmation.
That's it!

From within WooCommerce, there is no way you can reset the order numbers. There are some plugins that can do it.

Related

Woocommerce Set Default Variations

In Woocommerce some customers forget to select the variations or they don't know that they must select a variation first, so they keep clicking on the add to cart button but it doesn't work for them and they email me wondering why.
So, I thought of setting the first variation as default for all of the products.
I know I can do this through the admin but I cannot do this for all the products one by one, it's time consuming.
Please is there a code to add/edit to make the first variation the one selected by default?
I once were about to do the same and what i've found after searching a bit is this: https://quadlayers.com/default-product-attributes-woocommerce/
Basically he just hooks into woocommerce_before_single_product_summary and applies some logic that programmatically set the same thing you would set by going into the backend.
Beside this being maybe a good idea i finally gave up because i had to maintain an order into my variation choices and doing this would have break it for sure in the long term (imagine something like a dimension and you have it sorted, like 10,100,1000. You run the code today and it sets 10 as the default, then one day you add 5 and it is no longer correct)
Maybe you should think about giving some visual feedback to your users when they don't select the variation, that might solve the issue and actually create more internet-aware ppls around =)

How to recalculate order taxes and total programmatically in woocommerce

I use woocommerce from Admin only and add orders manually from Admin panel only.
Everything works fine except tax calculation.
After adding products, I must click Recalculate to be able to apply relevant taxes. If I forget, invoice does not include taxes.
I am wondering if there's a way to apply all the steps performed by Recalculate button during order update. I have custom meta boxes and many order meta that I save programmatically on order update.
Let me know if the question isn't clear, this is my first post here.
Thanks for your help.
This might help a bit into some direction:
$this->order = new WC_Order($order_id);
// Order back to pending
$this->order->update_status('pending', '<%Your message%>', TRUE);
// Recalculate the order
$total = $this->order->calculate_totals();
// Save it, although the calculate also does it.
$this->order->save();
I am not really sure about it, but it might get you going (if still needed)

Woocommerce - adding possibility to add note to order via customer

Is there way to allow customer to add note to order (after purchase) on his order page (my-account/show-order/{order_no}/)
Or maybe is there any plugin for it?
For example: client purchased some items and he forgot to note something to this order. I would like to give him posibility to add note directly to this order.

How to force addition of Product B in order to add product A in Drupal 7?

I am looking for an easy way to associate two products with each other on checkout while at the same time forcing the user to create the association if it doesn't exist yet. Basically, a user can by hosting, but in order to complete the checkout, they also need a domain name. I have classes for each, but I am trying to think of ways to solve two problems:
On checkout, display that two products are associated
Force the user to create the association
Any ideas on what I can use to do that?
UPDATE
What I did was:
Created two separate products
If you add the one, it does a check to see if this item has been linked to another product
If not, it takes you to a custom page forcing you to add and assign the other product
This works, but it's not very elegant. Any better suggestions would be much appreciated.
Use Rules to display messages to the user. Use the event on "add to cart", check the type of product, then check to see if the associated product is added to the cart, if not show message saying you also need to add a hosting package and auto redirect them there. Then upon checkout, check to see if one of those products exist, does the other exist in the cart? Throw same message and auto redirect them to the missing one.
You may need to use components with your rules to get the full effect. But that is what I would do.

Ubercart add to cart trigger?

I want to keep track of all items added to uber cart. I.e. Whenever someone clicks ADD TO CART, I want to: create a database entry of the time and item added.
This way I can see which items are most clicked on.
The logic to add it to a db etc is easy to do. What I need to know is, how do I plug into the "add to cart" part. I.e. How do I know when this has been clicked?
You should be able to implement hook_add_to_cart in a custom module, which will get called exactly as you describe above.
In Drupal 7 it changed to hook_uc_add_to_cart

Resources