diff --git a/includes/frontend/class-yoone-product-bundles-frontend.php b/includes/frontend/class-yoone-product-bundles-frontend.php index 7b0fce5..b75a9e6 100644 --- a/includes/frontend/class-yoone-product-bundles-frontend.php +++ b/includes/frontend/class-yoone-product-bundles-frontend.php @@ -23,22 +23,22 @@ class Yoone_Product_Bundles_Frontend { * 设置所有与前端相关的钩子。 */ public function setup_hooks() { - // Handle the custom add-to-cart process for bundles + // 处理混装产品的自定义“添加到购物车”流程 add_filter('woocommerce_add_to_cart_validation', array($this, 'process_bundle_add_to_cart'), 10, 3); - // When a bundle container is removed, remove its children. + // 当混装容器被移除时,移除其子项目 add_action('woocommerce_cart_item_removed', array($this, 'remove_bundle_children'), 10, 2); - // Hide the "remove" link for child items in the cart. + // 隐藏购物车中子项目的“移除”链接 add_filter('woocommerce_cart_item_remove_link', array($this, 'hide_child_remove_link'), 10, 2); - // In the cart, show which bundle a child item belongs to. + // 在购物车中,显示子项目所属的混装产品 add_filter('woocommerce_get_item_data', array($this, 'display_child_bundle_link'), 10, 2); - // Add a body class to the bundle product page for easier styling. + // 为混装产品页面添加 body class,以便于样式化 add_filter('body_class', array($this, 'filter_body_class')); - // Replace the default "Add to Cart" button with our custom form. + // 用我们的自定义表单替换默认的“添加到购物车”按钮 add_action('woocommerce_single_product_summary', array($this, 'remove_default_add_to_cart_for_bundle'), 29); add_action('woocommerce_single_product_summary', array($this, 'render_bundle_add_to_cart_form'), 30); }