Questions tagged [orders]

USE ONLY for related questions to e-commerce. DO NOT USE in all other cases.

In Orders are the objects that contains all the details of customers purchases.

For Woocommerce, This tag mainly refer to Wordpress "shop_order" custom post type, to WC_Order Class (and sub classes) and also to wc_get_orders() query function.

1498 questions
138
votes
6 answers

How to get WooCommerce order details

In WooCommerce from the following line code: $order = new WC_Order( $order_id ); How can I get WooCommerce order details from the order id?
Faisal Ijaz
  • 1,812
  • 2
  • 12
  • 23
41
votes
5 answers

WooCommerce: Auto complete paid orders

Normally wooCommerce should autocomplete orders for virtual products. But it doesn't and this is a real problem, even a BUG like. So at this point you can find somme helpful things(but not really convenient): 1) A snippet code (that you can find in…
LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
34
votes
4 answers

Add extra meta for orders in Woocommerce

I'm creating a custom plugin for my website. In some part of this plugin I need to store extra meta in wp_postmeta for each orders. I added this in my plugin's class: add_action ('woocommerce_before_checkout_process', array( &$this, 'add_item_meta',…
Mo Saeedi
  • 575
  • 1
  • 5
  • 15
33
votes
3 answers

Getting order data after successful checkout hook

In WooCommerce, I would like to send a request to an API once the customer has successfully checked out. Its basically a website where the client is selling online courses (Like udemy). When the customer checks out, I would like to send an API…
32
votes
3 answers

Woocommerce - Getting the order item price and quantity.

Using Woocommerce 2.6.8 , I can't get the Order Item Data information as described in the docs and here on SO. All I want is to get the Line Item price and Quantity, which should be as simple as: $order = new WC_Order( $order_id ); $order_items =…
robobobobo
  • 739
  • 1
  • 9
  • 19
29
votes
2 answers

Get Order items and WC_Order_Item_Product in WooCommerce 3

Reading up the changes in WooCommerce 3.0, it seems that is not possible to anymore properties from order items directly, so I would assume that the following code needs to be changed, since it is spitting out an error: $order_item_id =…
Solomon Closson
  • 6,111
  • 14
  • 73
  • 115
27
votes
4 answers

Create an order programmatically with line items in Woocommerce 3+

I needed to create a Woocommerce order programatically, however using the 'old' Woocommerce made this a very dirty procedure. I had to insert all kind of database records manually, using many update_post_meta calls. Looking for a better solution.
Mattijs
  • 3,265
  • 3
  • 38
  • 35
26
votes
1 answer

Add columns to admin orders list in WooCommerce

I am using WooCommerce plugin for one of my ecommerce WordPress websites. I want to add some columns to my order listing page in the WooCommerce admin area. I am not able to find out where to add that. Can anyone advise which template page I need…
Upendra Sharma
  • 575
  • 2
  • 9
  • 28
25
votes
3 answers

Add a custom order note programmatically in Woocommerce admin order edit pages

In woocommerce I am trying to add a custom order note in the admin order edit pages through php (so programmatically). I haven't find the way yet. Any help will be appreciated.
Max
  • 803
  • 3
  • 10
  • 24
22
votes
6 answers

How to get order items ids to get some product meta data?

I'm trying to extract item meta value from Woocommerce's orders by using: $data = wc_get_order_item_meta( $item, '_tmcartepo_data', true ); However, I can't find a way to get order_item_id as the first parameter (using get_items) global…
camelot
  • 301
  • 1
  • 3
  • 12
20
votes
2 answers

Get coupon data from WooCommerce orders

I have created in WooCommerce two custom coupon types: function custom_discount_type( $discount_types ) { $discount_types['cash_back_fixed'] =__( 'Cash Back fixed discount', 'woocommerce' ); $discount_types['cash_back_percentage'] =__(…
Gaurav
  • 201
  • 1
  • 2
  • 9
19
votes
2 answers

Get the metadata of an order item in woocommerce 3

how to get metadata of a product woocommerce? I have field custom en my products and I need to get this data. {"ID":151, "ORDER_ID":251, "NAME":"car", "PRODUCT_ID":87, "VARIATION_ID":0, "QUANTITY":1, "TAX_CLASS":"", "SUBTOTAL":"3", …
Manu
  • 319
  • 1
  • 2
  • 10
18
votes
2 answers

Woocommerce: Get all orders for a product

In the Woocommerce API I see a method wc_get_orders WooCommerce Order Functions In the mentioned args I do not see an argument in which I could provide a product ID or Object to limit order results only for that specific product. Is there a way I…
Fahad Sohail
  • 1,818
  • 4
  • 21
  • 33
18
votes
2 answers

Detecting if the current user has an active subscription

I'm developing a website in WordPress with WooCommerce. I'm using additionally WC Paid Listings and WooCommerce Subscriptions plugins to handle my work. The problem is when a user with "subscriber" role with an active subscription login tries to…
Knight
  • 343
  • 1
  • 4
  • 16
18
votes
6 answers

How to remove test orders from Magento2

Please explain me the proper way to remove the test orders in Magento2 website.I removed all records from 'sales_order' table but still the orders exist in the backend.
VIPIN A ROY
  • 1,761
  • 5
  • 28
  • 41
1
2 3
99 100