Advertisement
geminilabs

Untitled

Mar 16th, 2025 (edited)
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. /**
  2.  * @param bool $skip  Whether the notification should be skipped for the provided order
  3.  * @param \WC_Order $order  The WooCommerce Order object
  4.  *
  5.  * @return bool - true if the notification should be skipped, false otherwise.
  6.  */
  7. add_filter('site-reviews-notifications/product/reminder/skip', function ($skip, $order) {
  8.     $user = $order->get_user();
  9.     if (!$user) {
  10.         return true; // Skip for guest orders or if user not found
  11.     }
  12.     if (wc_get_customer_order_count($user->ID) > 1) {
  13.         return true; // Skip if not the first order
  14.     }
  15.     if (!in_array('retail', $user->roles)) {
  16.         return true; // Skip if user does not have the retail role
  17.     }
  18.     return false; // Proceed with notification
  19. }, 10, 2);
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement