• Resolved sercai

    (@sercai)


    Hello,

    For virtual products, I would like to only ask for Name and email from the customers.
    I removed all other fields using such code “unset($fields[‘billing’][‘billing_address_1’]);”

    Is there a way to remove the tipping option from checkout page as well for virtual products only ?
    https://prnt.sc/OWaGQ6wvSm1i

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author railmedia

    (@railmedia)

    Hi there @sercai,

    In v 1.2.2 I introduced the following filter:

    wc_order_tip_display_form

    It takes in 1 parameter either 1/0 or true/false. Setting it to false would prevent the order tip form to be displayed. You’d have to perform the proper checks on your end to see if your cart contains any virtual products in which case, you can set this value to false.

    Example:

    
    add_filter( 'wc_order_tip_display_form', 'my_virtual_products_check', 10, 1 );
    function wc_order_tip_display_form( $display ) {
      //Add logic here to check if your cart contains any virtual products
      return $display;
    }
    

    Best,
    Adrian

    Thread Starter sercai

    (@sercai)

    Thanks,
    Your filter works great.

    P.S: I think you did a mistake in your example, the function name should be my_virtual_products_check.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove tipping for virtual products’ is closed to new replies.