'yes', // yes|no 'product_id' => 0, ), $atts, 'yoone_bundle_selector'); $use_current = strtolower($atts['use_current_product']) === 'yes' || $atts['use_current_product'] === '1' || $atts['use_current_product'] === 1; $product_id = absint($atts['product_id']); // 解析产品对象 $product = null; if ($use_current && function_exists('is_singular') && is_singular('product')) { global $post; if ($post) $product = wc_get_product($post->ID); } elseif ($product_id > 0) { $product = wc_get_product($product_id); } // 安全检查:仅渲染我们定义的混装产品类型 if (! $product || ! method_exists($product, 'get_type') || $product->get_type() !== Yoone_Product_Bundles::TYPE) { return '