How to get product categories for the current order item?
问题 I am trying to get the product categories for the woocommerce order item at woocommerce_checkout_create_order_line_item hook. I am able to successfully get the product_id (thanks to help I got here) but now trying to get the product's categories the array comes back empty trying $product->get_categories() and alternatively trying wc_get_product_category_list($product->get_id(). I can't figure out what I am doing wrong. add_action('woocommerce_checkout_create_order_line_item', 'add_order_item