Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xlplugins/13768ed3c002f0ff00ba3fe0ac3c9cef to your computer and use it in GitHub Desktop.
Save xlplugins/13768ed3c002f0ff00ba3fe0ac3c9cef to your computer and use it in GitHub Desktop.
Switch Checkout pages for virtual and simple cart products
add_filter( 'wfacp_global_checkout_page_id', function ( $id ) {
$virtual_product_checkout_id=2930; // Make new checkout page for only virtual product and assign here
$non_virtual_product_checkout_id=2895; // Make a new checkout page for non virtual product and assign here
if ( 0 == $id || is_null( WC()->cart )) {
return $id;
}
$cart_count=WC()->cart->get_cart_contents_count();
if($cart_count > 1){
return $id;
}
if ( WFACP_Common::is_cart_is_virtual() ) {
return $virtual_product_checkout_id;
}
return $non_virtual_product_checkout_id;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment