Reputation: 2792
I am trying to conditionally show some content based on a few Woocommerce conditionals.
I want to show content when:
Not on a product page
Not on the checkout page
But, on the order received checkout endpoint
The below code is not quite working, the first 2 work correctly but the endpoint doesn't seem to work as it is part of the checkout page? Any ideas how to adjust?
<? if( !is_product() && !is_checkout() && is_wc_endpoint_url('order-received' ): ?>
MY CONTENT
<? endif ?>
Upvotes: 1
Views: 139
Reputation: 1341
If the endpoint is conditional on is_checkout()
being true, you could adjust it with an OR condition within brackets so it'll evaluate to true. If both are false the content won't show, but if either one is true it will, assuming !is_product()
is true.
<? if( !is_product() && (!is_checkout() || is_wc_endpoint_url('order-received' )): ?>
Upvotes: 1