2

Does anyone knows what is the hook in WooCommerce to get all the purchase details when you checkout?

I can not find it anywhere.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • You may want to check the WooCommerce hooks reference for this information - it lists all hooks: https://woocommerce.github.io/code-reference/hooks/hooks.html `woocommerce_after_checkout_validation` seems promising. This is not submitted as an answer as I am not certain this is what you need or want based on your question - you may want to clarify your intentions as well. – Ethan McTague Feb 24 '21 at 04:10

1 Answers1

1

The hook that you are looking at is woocommerce_checkout_create_order_line_item, located in WC_Checkout method create_order_line_items()

The woocommerce_checkout_create_order_line_item action hook allows to adjust line item before save. It has 4 defined arguments:

  • $item is the WC_Order_Item_Product object
  • $cart_item_key is the related cart item key
  • $values is the related cart item
  • $order is the WC_Order Object

All StackOverFlow treads using woocommerce_checkout_create_order_line_item action hook.

Related: Get Order items and WC_Order_Item_Product in WooCommerce 3

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399