Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this questionI've simplified my woocommerce by putting my cart and checkout all in one page. The annoying part of this is how to differentiate hooks and filters. Every example I see uses a page check like:
if ( !function_exists( 'turn_shipping_off_on_cart_view_only' ) ){
function turn_shipping_off_on_cart_view_only(){
if ( is_cart() ){
return false;
}
return true;
}
}
add_filter('woocommerce_cart_needs_shipping', 'turn_shipping_off_on_cart_view_only');
The problem is with the cart and the checkout on the same page the above always evaluates false and turns off the shipping prompt.
edit
Though the subject of this is woocommerce, I feel it is on topic, as the general behavior of hooks and page checks are the same no matter what plugin is being used.