Removing Terms & Conditions Checkbox for a specific product
-
Hello, I am trying to Hide or Remove Terms & Conditions checkbox from checkout page for a specific product, not for all products. Here is the link, https://magicbookofrecord.com/stores/checkout/?add-to-cart=9918&quantity=1
I am trying below code, but it’s working for privacy policy, this code not working for terms and conditions checkbox.
add_action('woocommerce_checkout_init', 'disable_checkout_terms_and_conditions', 10 ); function disable_checkout_terms_and_conditions(){ // Product ID to hide fields for $target_product_id = 9918; // Replace with the actual product ID // Get available payment gateways foreach( WC()->cart->get_cart() as $cart_item ) { if( $cart_item['data']->get_id() == $target_product_id ) { remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_checkout_privacy_policy_text', 20 ); remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 ); } } }
Please help me from this issue .
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Removing Terms & Conditions Checkbox for a specific product’ is closed to new replies.