Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have tried to disable the Billing information checkout pane from UI or in a custom module with 2 ways
function mymodule_commerce_checkout_pane_info_alter(&$checkout_pane) {
global $user;
foreach ($checkout_pane as $pane_name => & $pane_data) {
if ($pane_name == 'customer_profile_billing') {
$order = commerce_cart_order_load($user->uid);
if ($user->uid > 0) {
unset($checkout_pane['customer_profile_billing']);
}}}}
function mymodule_commerce_checkout_pane_info_alter(&$checkout_pane) {
global $user;
foreach ($checkout_pane as $pane_name => & $pane_data) {
if ($pane_name == 'customer_profile_billing') {
$order = commerce_cart_order_load($user->uid);
if (!empty($order->data)) {
unset($checkout_pane['customer_profile_billing']);
}}}}
none of them seems to work as the user still must press the 'continue to next step' button
(I have set not required the address field in admin/commerce/customer-profiles/types/billing/fields/commerce_customer_address )
any ideas what else should I try?
Comments
Comment #2
rszrama CreditAttribution: rszrama commentedSounds to me like you're confusing issues - unsetting a checkout pane is different from disabling a checkout page. In reality, if you are wanting to skip a checkout page, I recommend hooking into the checkout router, not attempting to unset checkout panes.
Comment #3
redhatusr CreditAttribution: redhatusr commentedrszrama thanks for your reply. I have searched the internet for examples about checkout router and I think there are only 4, all of them seem to work like this:
but the above code does nothing to my site. I have run out of examples. Can you give me a hint about what to search for?
thanks
Comment #4
yaach CreditAttribution: yaach as a volunteer commentedAny update on this.
I also have the need to disable a checkout page (in my case is the registration page). I have different product types, some of them do not require registration.