How to get links to the products at checkout?

Hello, how to get links to the products at checkout in Woocommerce? Need to transfer data to CRM, something like $order->get_items(), but as I understand the link to get
March 23rd 20 at 19:12
1 answer
March 23rd 20 at 19:14
Solution
Most likely it is:
// Get an instance of the WC_Order object
$order = wc_get_order($order_id);

// Iterating through each WC_Order_Item_Product objects
foreach ($order->get_items() as $item_key => $item_values):

 ## Using WC_Order_Item methods ##

 // Item ID is directly accessible from the $item_key in the foreach loop or
 $item_id = $item_values->get_id();

 ## Using WC_Order_Item_Product methods ##

 $item_name = $item_values->get_name(); // Name of the product
 $item_type = $item_values->get_type(); // Type of the order item ("line_item")

 $product_id = $item_values->get_product_id(); // the Product id
 $wc_product = $item_values->get_product(); // the WC_Product object
 ## Access the Order Items data properties (in an array of values) ##
 $item_data = $item_values->get_data();

 $product_name = $item_data['name'];
 $product_id = $item_data['product_id'];
 $variation_id = $item_data['variation_id'];
 $quantity = $item_data['quantity'];
 $tax_class = $item_data['tax_class'];
 $line_subtotal = $item_data['subtotal'];
 $line_subtotal_tax = $item_data['subtotal_tax'];
 $line_total = $item_data['total'];
 $line_total_tax = $item_data['total_tax'];

endforeach;
Yes, thank you, seen this code before, but the brain is not enough so to get the first ID of the product, and then just get_permalink(), thank you) - Bori commented on March 23rd 20 at 19:17

Find more questions by tags WooCommerceWordPressCRM