public function idBySlug(string $slug, bool $no_cache = false): int
    {
        static $product_ids;

        if (!($slug = (string) $slug)) {
            return 0; // Not possible.
        } elseif (isset($product_ids[$slug])) {
            return $product_ids[$slug];
        } elseif ((string) (int) $slug === $slug) {
            return $product_ids[$slug] = (int) $slug;
        }
        $WpDb = $this->s::wpDb(); // DB instance.

        $sql = /* Get the product ID for this slug. */ '
            SELECT `ID` FROM `'.esc_sql($WpDb->posts).'`
                WHERE
                    `post_type` IN(\'product\', \'product_variation\')
                    AND `post_name` = %s
            LIMIT 1';
        $sql = $WpDb->prepare($sql, $slug); // Prepare.

        if (($product_id = (int) $WpDb->get_var($sql))) {
            return $product_ids[$slug] = $product_id;
        }
        return $product_ids[$slug] = 0; // Not possible.
    }