Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param bool $skip Whether the notification should be skipped for the provided order
- * @param \WC_Order $order The WooCommerce Order object
- *
- * @return bool - true if the notification should be skipped, false otherwise.
- */
- add_filter('site-reviews-notifications/product/reminder/skip', function ($skip, $order) {
- $user = $order->get_user();
- if (!$user) {
- return true; // Skip for guest orders or if user not found
- }
- if (wc_get_customer_order_count($user->ID) > 1) {
- return true; // Skip if not the first order
- }
- if (!in_array('retail', $user->roles)) {
- return true; // Skip if user does not have the retail role
- }
- return false; // Proceed with notification
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement