-
Hi
I am looking to disable a GP element based on the URL – is this possible?
If not, is there any other way to disable an element on the woocommerce thank you page after an order is placed? We use a checkout header that is an element but after the order it is not relevant and so needs removing.
-
David
Hi there,
the woo thank you page has its own Woocommerce endpoint:
is_wc_endpoint_url( 'order-received' )
And you can use it like so in a PHP Snippet to remove a GP Element:
add_filter( 'generate_element_display', function( $display, $element_id ) { if ( ! function_exists( 'is_wc_endpoint_url' ) ) { return $display; } if ( 123 == $element_id && is_wc_endpoint_url( 'order-received' ) ) { return false; } return $display; }, 10, 2 );
In the code the
123
is the ID of the element change that to match your elements ID -
Worked perfectly – thank you!
-
David
Glad to hear that!
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.