[Resolved] GP Elements Display Rule Woocommerce checkout subpages

Home Forums Support [Resolved] GP Elements Display Rule Woocommerce checkout subpages

Home Forums Support GP Elements Display Rule Woocommerce checkout subpages

  • This topic has 3 replies, 2 voices, and was last updated 5 months ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2151001
    Manuel

    Hello,

    how can i exclude for example an GP element for woocommerce subpages like checkout/order-received.

    So basically what I am trying to achieve is to remove/add some GP elements on the checkout page of woocommerce. For this I am using the display rule Location: ‘Page’ -> ‘checkout’.

    After the user submits the order, he will be redirected to the ‘checkout/order-received’ page. But on this page the display rules should no longer apply.
    But actually i am not able to exclude an GP element with a filter like Exclude: ‘Page’ -> ‘checkout’ -> ‘order-received’

    Can you help me here?

    #2151015
    David
    Staff
    Customer Support

    Hi there,

    you can use this PHP Snippet:

    add_filter( 'generate_element_display', function( $display, $element_id ) {
        if ( 100 === $element_id && is_wc_endpoint_url( 'order-received' ) ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );

    Note the 100 needs to be changed to the ID of your Element

    #2151776
    Manuel

    Hello David,
    thank you very much.
    Your solution works perfectly. Do you know if there is a plan to integrate this into the display rules editor? So that it is not necessary to add this functionality as code?

    You can imagine that this makes the whole thing confusing, since the visibility of an element is controlled in 2 different places.

    #2151781
    David
    Staff
    Customer Support

    It might be something we incorporate in a future update. I have made a note 🙂

    Glad to be of help

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.