Avatar How can I set my variable to equal the quantity ordered on the Order Deta
-
Avatar
How can I set my variable to equal the quantity ordered on the Order Details page?I am working on my own function. I need to get the total quantity of orders purchased. I am only selling one single product, and when someone buys it I need to get the total number of the product that they purchased. Before a purchase is made this script will set my variable $mm to equal the total number in the cart.
<?php global $woocommerce; $mm=$woocommerce->cart->cartcontentscount;
however I want to make sure that the order is complete before I record this number. So I think that the function should be called on the woocommerce_thankyou hook. However then the cart is cleared so that script doesn’t work on that hook. Though I know that the info is still available since the order details tells the quantity of each product ordered. So I need to know how to get my variable $mm to equal the valuable of the quantity of the product that was ordered and is displayed on the Order Details page. How can I do this?
- The topic ‘Avatar How can I set my variable to equal the quantity ordered on the Order Deta’ is closed to new replies.