• Resolved iqqsam182

    (@iqqsam182)


    I have “Enable the shipping calculator on the cart page” disabled and “Hide shipping costs until an address is entered” enabled to disable shipping cost calculations to be viewed on the cart page, this is however conflicting with the function where I unset the ZIP code in default addresses function.
    How can I solve this? Unsetting postal code forces default address to be calculated and shown on the cart page

    my function:
    add_filter( ‘woocommerce_default_address_fields’ ,’override_default_address_fields’ );
    function override_default_address_fields( $fields ) {
    // unset($fields[‘postcode’]);
    }

    • This topic was modified 4 years, 5 months ago by iqqsam182.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support EastOfWest a11n

    (@eastofwest)

    Hi there,

    Perhaps there is a better approach to this. For context, can you expand on what you are trying to achieve here overall, and specifically why you want to unset the postcode in the first place?

    Thread Starter iqqsam182

    (@iqqsam182)

    I only ship to one country and the shipping costs vary depending on the region/area, postcode is really not used and not necessary. What I actually did is create 3 new states using a function for this country and had shipping costs set and everything works perfectly, but as mentioned above
    1) I don’t want the postcode to be entered
    2) I have a system where I allow checkout on the cart page, I have a custom checkout function to do this, now using this function I’ll be responsible for manually calculating the shipping costs, the user doesn’t have to enter any billing/shipping address using the method, in short I don’t want the shipping cost to be calculated on the cart page because the user doesn’t have to enter an address (especially when logged out), I’m thinking of enabling the postcode and just hide it with CSS

    Suggestions?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘unset zip code conflicts with disabling shipping calculations on cart’ is closed to new replies.