/** * Removes user from waitlist on purchase if persistent waitlists are enabled * * @static * @param object $order WC_Order object * @access public * @return void */ public static function check_order_for_waitlisted_items($order) { if (self::persistent_waitlists_are_disabled()) { return; } if (self::automatic_mailouts_are_disabled()) { return; } $user = get_user_by('id', $order->user_id); foreach ($order->get_items() as $item) { if ($item['id'] > 0) { $_product = $order->get_product_from_item($item); $waitlist = new Pie_WCWL_Waitlist($_product); $waitlist->unregister_user($user); } } }
/** * Output required HTML for the custom tab for variable products */ public function build_custom_tab_for_variable() { $children = $this->product->get_available_variations(); foreach ($children as $key => $child) { $variation = get_product($child['variation_id']); $variation_waitlist = new Pie_WCWL_Waitlist($variation); $users = $variation_waitlist->get_registered_users(); if (!empty($users) || !$variation->is_in_stock()) { echo '<div id="wcwl_variation_' . $child['variation_id'] . '" class="wcwl_product_tab_wrap">'; echo '<div class="wcwl_header_wrap"><h3>' . $this->return_variation_tab_title($variation_waitlist) . '</h3></div>'; echo '<div class="wcwl_body_wrap">'; if (empty($users)) { echo '<p class="wcwl_no_users_text">' . esc_html(apply_filters('wcwl_empty_waitlist_introduction', $this->empty_waitlist_introduction)) . '</p>'; echo $this->return_option_to_add_user($variation_waitlist); } else { echo '<p class="wcwl_intro_tab">' . esc_html(apply_filters('wcwl_waitlist_introduction', $this->waitlist_introduction)) . '</p>'; echo '<div class="wcwl_waitlist_tab"><table class="widefat wcwl_product_tab">'; foreach ($users as $user) { echo $this->return_user_info($user, $variation_waitlist); } echo '</table></div>'; echo $this->return_option_to_add_user($variation_waitlist); echo '<p><div class="dashicons dashicons-email-alt wcwl_email_all_tab"></div><a href="' . esc_url_raw($this->get_mailto_link_content($variation_waitlist)) . '" >' . esc_html($this->email_all_users_on_list_text) . '</a></p>'; } echo '</div></div>'; } unset($children[$key]); } echo '<p id="wcwl_in_stock_notice" class="wcwl_in_stock_notice">' . esc_html(apply_filters('wcwl_waitlist_variation_instock_introduction', $this->variable_instock_intro)) . '</p>'; }
/** * Outputs total waitlist members for a given post ID if $column_name is our custom column * * @hooked action manage_product_posts_custom_column * @param string $column_name name of the column for which we are outputting data * @param mixed $post_ID ID of the post for which we are outputting data * @access public * @return void * @since 1.0 */ public function add_column_content($column_name, $post_ID) { $Product = get_product($post_ID); if (WCWL_SLUG . '_count' != $column_name) { return; } $content = Pie_WCWL_Waitlist::get_number_of_registrations_by_product_id($Product->id); echo empty($content) ? '<span class="na">–</span>' : $content; }