template_url; } $plugin_path = untrailingslashit( WCSOB_PLUGIN_PATH ) . '/woocommerce/'; // Look within passed path within the theme - this is priority $template = locate_template( array( $template_path . $template_name, $template_name ) ); if ( ! $template && file_exists( $plugin_path . $template_name ) ) { $template = $plugin_path . $template_name; } if ( ! $template ) { $template = $_template; } return $template; } /** * Hide Sale badge if product is out of stock * * @noinspection PhpUnusedLocalVariableInspection * * @param string $content * @param array|null|WP_Post $post * @param false|null|WC_Product $product * * @return string|null */ public static function hide_sale_flash( string $content, $post, $product ): ?string { global $post, $product; return ( Settings::should_hide_sale_flash() && Badge::showOnOutofstock() && ! $product->is_in_stock() ) ? null : $content; } /** * Replace "Out of stock" text with "Sold out!" * * @param string $html * @param false|null|WC_Product $product * * @return string */ public static function replace_out_of_stock_text( string $html, $product ): string { if ( Badge::showOnOutofstock() && ! $product->is_in_stock() && ! Badge::is_hidden() ) { return '

' . Badge::get_text() . '

'; } return $html; } /** * Show or hide Sold Out badge when user select a variation in dropdown */ public static function show_badge_on_variation_select() { ?>