/*
 Theme Name: Netbrux Fusion Theme
 Theme URI: https://woostify.com/
 Description: Unleash your online business potential with the Digistore Ready-Made Website By netbrux.com. Our all-in-one e-commerce solution offers unlimited product listings, pre-loaded top-selling products, automation, premium themes, genuine licenses, and lifetime updates. It’s hassle-free, efficient, and ready for your digital empire to thrive. Get started today!


 Author: netbrux.com
 Author URI: https://netbrux.com/
 Template: woostify
 Version: 2.6.9
*/
// Always show full shipping fields for guest checkout
add_filter( 'woocommerce_checkout_fields', 'force_shipping_fields_guest', 100 );

function force_shipping_fields_guest( $fields ) {

    // Check if user is a guest
    if ( ! is_user_logged_in() ) {

        // --- Shipping Fields ---
        $fields['shipping']['shipping_first_name'] = array(
            'label'    => 'First Name',
            'required' => true,
            'class'    => array('form-row-first'),
            'priority' => 10,
        );
        $fields['shipping']['shipping_last_name'] = array(
            'label'    => 'Last Name',
            'required' => true,
            'class'    => array('form-row-last'),
            'priority' => 20,
        );
        $fields['shipping']['shipping_address_1'] = array(
            'label'    => 'Street Address',
            'required' => true,
            'class'    => array('form-row-wide'),
            'priority' => 30,
        );
        $fields['shipping']['shipping_address_2'] = array(
            'label'    => 'Apartment, suite, etc. (optional)',
            'required' => false,
            'class'    => array('form-row-wide'),
            'priority' => 31,
        );
        $fields['shipping']['shipping_city'] = array(
            'label'    => 'City',
            'required' => true,
            'class'    => array('form-row-first'),
            'priority' => 35,
        );
        $fields['shipping']['shipping_state'] = array(
            'label'    => 'State / County',
            'required' => true,
            'class'    => array('form-row-last'),
            'priority' => 36,
        );
        $fields['shipping']['shipping_postcode'] = array(
            'label'    => 'ZIP / Postal Code',
            'required' => true,
            'class'    => array('form-row-first'),
            'priority' => 37,
        );
        $fields['shipping']['shipping_country'] = array(
            'type'     => 'country',
            'label'    => 'Country',
            'required' => true,
            'class'    => array('form-row-last'),
            'priority' => 38,
        );

        // Force shipping fields to be visible
        add_filter( 'woocommerce_ship_to_different_address_checked', '__return_true' );
    }

    return $fields;
}