danidan
Forum Replies Created
-
Submitted can you check it?
I modified the priceCalculator.php file’s calculateSinglePrice funtion to change the product price to 0 based on the customer’s orders details. its worked but i need product quantity inside the cart.
$item->getQty(); its return 1 value if cart is empty
may i know how can i get the product quantity inside the cart?
$orderArg = array(
‘customer_id’ => $userId,
‘limit’ => -1,
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
? ? ? ? );
?$orders = wc_get_orders($orderArg);
if ($orders) { foreach ($orders as $orderData) { foreach ($orderData->get_items() as $item_id => $items) { $id = $items->get_product()->get_id(); $item_quantity = $items->get_quantity(); if ($id == $varientId) { $totalQty += $item_quantity; $productCartId = $items->get_product()->get_id(); } } } }
I got particular product’s quantity from previous order but where can i add this to for validate ?
Its not worked do u have any other solution for the related issue?
Thank you so much for your reply i will check this out