17

How to Create a WooCommerce Thank You Page Condition in Oxygen Builder

Powered by WPCodeBox

Discover how to create a WooCommerce thank you page condition in Oxygen Builder. This condition helps display specific elements only after a successful WooCommerce checkout, ensuring a tailored user experience.


<?php

add_action('plugins_loaded', function () {

    if (function_exists('oxygen_vsb_register_condition')) {

        oxygen_vsb_register_condition('Is Thank You Page', array('options' => array('true'), 'custom' => false), array('=='), 'is_thank_you_callback', 'WooCo');

        function is_thank_you_callback($value, $operator)
        {

            if (is_checkout() && !empty(is_wc_endpoint_url('order-received'))) {
                return true;
            }

        }

    }
});

Other Snippets

WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.