Support » Plugin: WooCommerce » Overwriting shipping address problem

  • Resolved mic85b

    (@mic85b)


    Hello,

    I need to change shipping address to address of my pickup point (when this option of delivery has been choosen)

    Removeing is easy for me but (first code) but setting not working for me (second code). Please help me. Of course this code go to functions.php of my child theme.

    Removing – it is working

    add_filter(‘woocommerce_checkout_fields’, ‘plus_remove_shipping_checkout_fields’);

    function plus_remove_shipping_checkout_fields($fields) {
    $shipping_method =’pickup-location-method’; // Set the desired shipping method to hide the checkout field(s).
    global $woocommerce;
    $chosen_methods = WC()->session->get( ‘chosen_shipping_methods’ );
    $chosen_shipping = $chosen_methods[0];

    if ($chosen_shipping == $shipping_method) {
    unset($fields[‘shipping’][‘shipping_address_1’]); // Add/change filed name to be hide
    unset($fields[‘shipping’][‘shipping_address_2’]);

    }
    return $fields;
    }

    It doesn’t work

    add_filter( ‘woocommerce_checkout_fields’ , ‘change_shipping_to_pickup_point’ );

    function change_shipping_to_pickup_point($fields)
    {
    $shipping_method =’pickup-location-method’; // Set the desired shipping method to hide the checkout field(s).
    global $woocommerce;
    $chosen_methods = WC()->session->get( ‘chosen_shipping_methods’ );
    $chosen_shipping = $chosen_methods[0];

    if ($chosen_shipping == $shipping_method) {
    $fields[‘shipping’][‘shipping_address_1’] = ‘Punkt odbioru’;
    $fields[‘shipping’][‘shipping_address_1’] = ‘Integart’;
    }
    return $fields;

    }

Viewing 1 replies (of 1 total)
  • Plugin Support John Coy

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @mic85b

    You could use Local Pickup Plus provides a far more robust pickup system for retailers with multiple locations, distribution centers, or pickup sites. Provide pickup locations across the country (or in other countries!), limit pickup to certain items, restrict which products are available at a location, and accept scheduled pickup dates.

    Hopefully, this gets you going in the right direction to get the job done!

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.