How to Update the Order-Items While Editing an Order on the WooCommerce Admin Order Screen [closed]

The woocommerce_order_before_calculate_totals hook executes in the Edit Order admin screen when an item is changed or the ‘recalculate’ button is pressed. This allows you to loop through each item and fee in the order and edit as required. I have a fee called ‘Deposit’ which I update if it exists or I add if it … Read more

Hide account tab to certain users

I’m not sure what the snippet you used is, but you can wrap it in an if statement like this: if(in_array(‘wholesaler’, wp_get_current_user()->roles)) { // Your snippet here } This will only run the snippet that adds that tab when the user that is logged in has the wholesaler role. Be sure to replace wholesaler with … Read more

WooCommerce add class name in the list [closed]

There is no particular hook available to deal with classes in products list. Therefore, we need to edit, “content-product.php” present in, “template” folder of “woocommerce” plugin. We can add following code: $product_id = get_the_ID(); $result = wp_get_post_terms($product_id,’product_cat’); if(!empty($result)){ $term = ”; foreach($result as $single_result) { $term .= ‘ ‘ . $single_result->slug; } $classes[] = $term; … Read more

Woocommerce: how to know if the customer is canceled the order or the shop owner? [closed]

Would the owner really be ordering/cancelling oders that often? If not just trigger the notification on every cancellation. You could add a check against current user info and so long as its not the owners id – send the notification. Maybe start with this: wp_get_current_user() Or use: global $current_user; Directly. It should not be too … Read more