__('Description', 'woocommerce'), 'priority' => 10, 'callback' => 'woocommerce_product_description_tab', ); } return $tabs; } add_filter('woocommerce_product_tabs', 'rmg_woocommerce_default_product_tabs'); add_filter('woocommerce_product_stock_status_options', 'add_custom_stock_status'); function add_custom_stock_status($status_options) { $status_options['one_to_two_weeks'] = __('Production Time 1 to 2 weeks', 'woocommerce'); $status_options['two_to_three_weeks'] = __('Production Time 2 to 3 weeks', 'woocommerce'); $status_options['three_to_four_weeks'] = __('Production Time 3 to 4 weeks', 'woocommerce'); $status_options['four_to_five_weeks'] = __('Production Time 4 to 5 weeks', 'woocommerce'); $status_options['five_to_six_weeks'] = __('Production Time 5 to 6 weeks', 'woocommerce'); $status_options['six_to_seven_weeks'] = __('Production Time 6 to 7 weeks', 'woocommerce'); $status_options['seven_to_eight_weeks'] = __('Production Time 7 to 8 weeks', 'woocommerce'); $status_options['eight_to_nine_weeks'] = __('Production Time 8 to 10 weeks', 'woocommerce'); $status_options['nine_to_ten_weeks'] = __('Production Time 9 to 10 weeks', 'woocommerce'); $status_options['ten_to_eleven_weeks'] = __('Production Time 10 to 11 weeks', 'woocommerce'); $status_options['eleven_to_twelve_weeks'] = __('Production Time 11 to 12 weeks', 'woocommerce'); $status_options['time_to_be_advised'] = __('Production Time To Be Advised', 'woocommerce'); return $status_options; } add_filter('woocommerce_get_availability_text', 'custom_product_stock_status', 10, 2); function custom_product_stock_status($availability, $product) { $stock_status = $product->get_stock_status(); $custom_stock_statuses = array( 'one_to_two_weeks' => __('Production Time 1 to 2 weeks', 'woocommerce'), 'two_to_three_weeks' => __('Production Time 2 to 3 weeks', 'woocommerce'), 'three_to_four_weeks' => __('Production Time 3 to 4 weeks', 'woocommerce'), 'four_to_five_weeks' => __('Production Time 4 to 5 weeks', 'woocommerce'), 'five_to_six_weeks' => __('Production Time 5 to 6 weeks', 'woocommerce'), 'six_to_seven_weeks' => __('Production Time 6 to 7 weeks', 'woocommerce'), 'six_to_eight_weeks' => __('Production Time 6 to 8 weeks', 'woocommerce'), 'seven_to_eight_weeks' => __('Production Time 7 to 8 weeks', 'woocommerce'), 'eight_to_ten_weeks' => __('Production Time 8 to 10 weeks', 'woocommerce'), 'eight_to_ten_weeks' => __('Production Time 8 to 10 weeks', 'woocommerce'), 'nine_to_ten_weeks' => __('Production Time 9 to 10 weeks', 'woocommerce'), 'ten_to_eleven_weeks' => __('Production Time 10 to 11 weeks', 'woocommerce'), 'eleven_to_twelve_weeks' => __('Production Time 11 to 12 weeks', 'woocommerce'), 'time_to_be_advised' => __('Production Time To Be Advised', 'woocommerce'), ); if (array_key_exists($stock_status, $custom_stock_statuses)) { $availability = '

' . esc_html($custom_stock_statuses[$stock_status]) . '

'; } return $availability; } // Add custom stock status column to product list add_filter('manage_edit-product_columns', 'custom_product_stock_status_column'); function custom_product_stock_status_column($columns) { $columns['custom_stock_status'] = __('Stock Status', 'woocommerce'); return $columns; } // Display custom stock status value in product list column add_action('manage_product_posts_custom_column', 'custom_product_stock_status_column_value', 10, 2); function custom_product_stock_status_column_value($column, $post_id) { if ($column === 'custom_stock_status') { $product = wc_get_product($post_id); $stock_status = $product->get_stock_status(); $custom_stock_statuses = array( 'one_to_two_weeks' => __('Production Time 1 to 2 weeks', 'woocommerce'), 'two_to_three_weeks' => __('Production Time 2 to 3 weeks', 'woocommerce'), 'three_to_four_weeks' => __('Production Time 3 to 4 weeks', 'woocommerce'), 'four_to_five_weeks' => __('Production Time 4 to 5 weeks', 'woocommerce'), 'five_to_six_weeks' => __('Production Time 5 to 6 weeks', 'woocommerce'), 'six_to_eight_weeks' => __('Production Time 6 to 8 weeks', 'woocommerce'), 'six_to_seven_weeks' => __('Production Time 6 to 7 weeks', 'woocommerce'), 'seven_to_eight_weeks' => __('Production Time 7 to 8 weeks', 'woocommerce'), 'eight_to_nine_weeks' => __('Production Time 8 to 9 weeks', 'woocommerce'), 'eight_to_ten_weeks' => __('Production Time 8 to 10 weeks', 'woocommerce'), 'nine_to_ten_weeks' => __('Production Time 9 to 10 weeks', 'woocommerce'), 'ten_to_eleven_weeks' => __('Production Time 10 to 11 weeks', 'woocommerce'), 'eleven_to_twelve_weeks' => __('Production Time 11 to 12 weeks', 'woocommerce'), 'time_to_be_advised' => __('Production Time To Be Advised', 'woocommerce'), ); if (array_key_exists($stock_status, $custom_stock_statuses)) { echo '' . esc_html($custom_stock_statuses[$stock_status]) . ''; } else { echo '' . esc_html__('In Stock', 'woocommerce') . ''; } } } function custom_admin_js() { $url = get_bloginfo('template_directory') . '/custom.js'; echo '""'; } add_action('admin_footer', 'custom_admin_js'); function custom_admin_text_translation( $translated_text, $text, $domain ) { if ( $domain === 'woocommerce' ) { if ( $text === 'In Stock' ) { $translated_text = 'In Stock'; } } return $translated_text; } add_filter( 'gettext', 'custom_admin_text_translation', 20, 3 ); // Add custom notice below the coupon form add_action( 'woocommerce_before_checkout_form', 'add_custom_coupon_notice', 10 ); function add_custom_coupon_notice() { echo '
The currency conversion calculation you see is to enable you to picture how much the transaction is in your own chosen currency. The actual billing amount will be in US $ Dollars.
'; } add_filter('posts_where', 'my_search_is_exact_title', 10, 2); function my_search_is_exact_title($where, $query) { if (!is_admin() && $query->is_main_query() && $query->is_search) { global $wpdb; // Get the search terms $search_terms = $query->query_vars['s']; if (!empty($search_terms)) { // Escape the search terms for the query $search_terms = esc_sql($search_terms); // Modify the search query to only search in post titles $where .= " AND {$wpdb->posts}.post_title LIKE '%$search_terms%'"; } } return $where; } add_filter('posts_where', 'custom_admin_product_search', 10, 2); function custom_admin_product_search($where, $query) { global $wpdb, $pagenow; if (is_admin() && $pagenow == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'product' && $query->is_main_query()) { if (isset($_GET['s']) && !empty($_GET['s'])) { $search_terms = sanitize_text_field($_GET['s']); // Escape the search terms for the query $search_terms = esc_sql($search_terms); // Modify the search query to only search in post titles $where .= " AND {$wpdb->posts}.post_title LIKE '%$search_terms%'"; } } return $where; }