Changeset 3388784
- Timestamp:
- 11/03/2025 10:54:54 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
woo-auction/trunk/public/class-woo-auction-product-handler.php
r3388741 r3388784 39 39 */ 40 40 private function init_hooks() { 41 // Replace add to cart form with bidding box42 remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30);41 // Ensure add to cart is only replaced for auction products 42 add_action( 'woocommerce_before_single_product', array( $this, 'setup_single_product_hooks' ) ); 43 43 add_action( 'woocommerce_single_product_summary', array( $this, 'display_auction_bidding_box' ), 30 ); 44 44 … … 48 48 // Add bid history after product tabs 49 49 add_action( 'woocommerce_after_single_product_summary', array( $this, 'display_bid_history' ), 15 ); 50 } 51 52 /** 53 * Prepare single product hooks based on product type. 54 * 55 * @since 1.0.0 56 */ 57 public function setup_single_product_hooks() { 58 global $product; 59 60 if ( ! $product ) { 61 return; 62 } 63 64 if ( 'auction' === $product->get_type() ) { 65 remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); 66 } else { 67 // Make sure non-auction products retain the default add to cart button 68 add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); 69 } 50 70 } 51 71
Note: See TracChangeset
for help on using the changeset viewer.