wpdev Posted July 16, 2020 Share Posted July 16, 2020 (edited) Hi, could you please help me with an issue? I want to hide the price for one product in the WooCommerce emails that I send to the clients Only If the quantity of a product is over 50. For all the other items I want the price to be shown. For example, the order has 2 products, one with 30pcs quantity that displays price, and the other with 120pcs quantity but with a text 'some text' instead of the price. I modified the email-order-items.php, <?PHP echo $order->get_formatted_line_subtotal($item); ?> But, It's not working. I'm sure is this line but I don't know how to continue and I'm stuck. Thank you so much. Edited July 16, 2020 by wpdev Modified information Quote Link to comment https://forums.phpfreaks.com/topic/311108-hide-price-in-email-only-if-quantity-over-50/ Share on other sites More sharing options...
kicken Posted July 16, 2020 Share Posted July 16, 2020 If you can get the quantity you could use a simple if statement. Something like <?php echo ($quantity>50)?'Secret':$order->get_formatted_line_subtotal($item);?> I'm not familiar with WooCommerce so I don't know how to determine $quantity, but if you look at the part of the template that shows the quantity you can probably figure it out. 1 Quote Link to comment https://forums.phpfreaks.com/topic/311108-hide-price-in-email-only-if-quantity-over-50/#findComment-1579739 Share on other sites More sharing options...
wpdev Posted July 16, 2020 Author Share Posted July 16, 2020 Hi kicken, thank you so so much, it works perfectly! 🙂 you were right, I just had to change the quantity part like this: <?php echo ($item['qty']>50)?'Secret':$order->get_formatted_line_subtotal($item);?> The only issue is that it still sums up the hidden quantity in the subtotal and total of the order. Thank you so much for your help! Quote Link to comment https://forums.phpfreaks.com/topic/311108-hide-price-in-email-only-if-quantity-over-50/#findComment-1579741 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.