I´ve read about the possibility to use this snippet to hide a specific checkout pane (in Drupalcommerce), according to the cart contents.
Could I use this somewhat modified to hide a pane when the user completing the order is registered?
<?php
function hook_commerce_checkout_pane_info_alter(&$checkout_pane) {
foreach ($checkout_pane as $pane_name => & $pane_data) {
if ($pane_name == 'customer_profile_shipping') {
$order = commerce_cart_order_load($user->uid);
if (!empty($order->data)) {
unset($checkout_pane['customer_profile_shipping']);
}}}}
?>
I understand that I should change this if (!empty($order->data)) {
maybe to something like this? if ($user->uid > 0) {
Is that correct? I want tu hide the pofile2 pane:
So it would be like this:
<?php
function hook_commerce_checkout_pane_info_alter(&$checkout_pane) {
foreach ($checkout_pane as $pane_name => & $pane_data) {
if ($pane_name == 'customer_profile_shipping') {
$order = commerce_cart_order_load($user->uid);
if ($user->uid > 0) {
unset($checkout_pane['commerce_p2cp_profile']);
}}}}
?>
I´m not sure how to add that into a rule set...