Title: Woocommerce Zip Code Overwriten
Last modified: February 2, 2026

---

# Woocommerce Zip Code Overwriten

 *  Resolved [dimattias](https://wordpress.org/support/users/dimattias/)
 * (@dimattias)
 * [4 months, 1 week ago](https://wordpress.org/support/topic/woocommerce-zip-code-overwriten/)
 * We have a problem with a plugin conflict caused by svea checkout always overwriting
   the zip code.
 * We have a second plugin managing delivery metadata on the checkout page. This
   plugin creates a two step checkout where the user fills in some extra information
   prior to continuing with the checkout process. The data requested is dependent
   on the delivery options, the delivery options are in turn dependent on the zip
   code.
 * The delivery option changing on the checkout page creates problems, therefor 
   the zip code may never be changed on the checkout page, and is instead sett in
   the cart before progressing to the checkout.
 * Unfortunately svea checkout appears to overwrite the zip code and change the 
   delivery options upon entering the checkout with the zip code saved in svea checkout.
   This also deselects the selected delivery option.
 * Is there any way to solve or avoid this.
 * The option: ”Sync ZIP code from Svea” is not selected. The problem still occurre.
 * We previously avoided the problem with using a earlier version of the svea checkout
   where the problem was avoidable. This is no longer an option due to various reasons
   including safety.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Support [alexanderwiden](https://wordpress.org/support/users/alexanderwiden/)
 * (@alexanderwiden)
 * [4 months ago](https://wordpress.org/support/topic/woocommerce-zip-code-overwriten/#post-18808118)
 * Hi,
 * I understand the issue. The customer object in WooCommerce are nowadays being
   populated by the information provided in Svea Checkout which includes the zip
   code(s) which is to ensure that the data in WooCommerce and Svea are aligned.
 * Would it be possible for you to create a step before the checkout (it’s own page)
   with the shipping/zip selector and then use the option “Zip code read-only when
   logged in” turned on in Svea Checkout? This will in effect lock the currently
   chosen zip-code when entering the checkout.
 * Best regards
 *  Thread Starter [dimattias](https://wordpress.org/support/users/dimattias/)
 * (@dimattias)
 * [4 months ago](https://wordpress.org/support/topic/woocommerce-zip-code-overwriten/#post-18812341)
 * This may work if there is a convenient way to sett the zip code in svea checkout
   prior to entering the checkout page.
 * “Zip code read-only when logged in” locks the zip code to what is previously 
   saved in svea, not what is saved in woocommerce. So the overwrite still happens
   as expected.
 * Is there any way to set the saved zip code in svea checkout prior to entering
   the checkout page?
 *  Plugin Support [alexanderwiden](https://wordpress.org/support/users/alexanderwiden/)
 * (@alexanderwiden)
 * [4 months ago](https://wordpress.org/support/topic/woocommerce-zip-code-overwriten/#post-18812723)
 * Hi,
 * Yes, that option simply pulls the current value from the `WC()->customer` object
   which in normal cases only is filled with information if the user is logged in(
   or already’ve made a purchase in the current session).
 * By setting the value via `WC()->customer->set_billing_postcode( 12345 )` the 
   value should be populated when entering the checkout.
 * Best regards
 *  Thread Starter [dimattias](https://wordpress.org/support/users/dimattias/)
 * (@dimattias)
 * [3 months, 1 week ago](https://wordpress.org/support/topic/woocommerce-zip-code-overwriten/#post-18834842)
 * We have now had time to test this further and we think we understand the problem
   in more detail.
 * Svea checkout do not populate the postcode used for shipping with the shipping
   postcode from the shipping address but instead populates it with the billing 
   postcode.
 * This means that if you set the shipping postcode (with in our case the Woocommerce
   cart shipping calculator) then Woocommerce will unsurprisingly not sett the billing
   postcode to the same. Svea checkout will later overwrite the postcode from the
   shipping address with the one from the billing address possibly causing changes
   to the available shipping options.
 * Forcefully setting the billing postcode to the same as the shipping postcode 
   when the shipping postcode is sett avoided the problem. The shipping and billing
   postcode being both set to the same value prevents Svea checkout from changing
   the shipping options via changing the postcode on the checkout page.
 * We have however found a second issue. Even if svea checkout and the checkout 
   page appear to recognize changes to the shipping postcode. The checkout iframe
   itself only appear to recognize the the postcode from woocommerce the first time(
   with or without write protection).
 * If the user backs out of the checkout process returns to the cart and selects
   a different postcode, the postcode in the iframe will not change even if the 
   postcode is set to a different value with
 *  `WC()->customer->set_billing_postcode( ... )`.
 * Is there any way to solve this?
 *  Plugin Support [Victor Westerlund](https://wordpress.org/support/users/victorwesterlund/)
 * (@victorwesterlund)
 * [2 months, 4 weeks ago](https://wordpress.org/support/topic/woocommerce-zip-code-overwriten/#post-18849642)
 * Hi,
 * Regarding the issue that you mention where changing a zip code in WooCommerce
   after an initial payment session is created, is unfortunately not something that
   can be easily updated after the fact.
 * What you could try is to hook into the `woocommerce_sco_needs_new_checkout` filter
   directly and trigger the creation of a new session when the zip code is updated
   in WooCommerce.
 * Best regards
 *  Thread Starter [dimattias](https://wordpress.org/support/users/dimattias/)
 * (@dimattias)
 * [2 months, 2 weeks ago](https://wordpress.org/support/topic/woocommerce-zip-code-overwriten/#post-18863712)
 * Thank you, this solved the problem.
 * Our solution now looks something like this:
 *     ```wp-block-code
       add_action( 'woocommerce_calculated_shipping', array( $this, 'save_shipping_calculator_fields' ), 10 );add_filter( 'woocommerce_sco_needs_new_checkout', array( $this, 'maybe_reset_svea_checkout' ), 10, 2 );add_filter( 'woocommerce_sco_create_order' , array( $this, 'trying_to_reset_svea_checkout' ), 10, 1 );		public function save_shipping_calculator_fields() {    //Save shipping postcode to billing to prevent it being overwritten by svea checkout    $postcode = isset( $_POST['calc_shipping_postcode'] ) ? wc_clean( wp_unslash( $_POST['calc_shipping_postcode'] ) ) : '';    if ( $postcode ) {        WC()->customer->set_billing_postcode( $postcode );        WC()->session->set( 'reset_svea_checkout', true );    }}function maybe_reset_svea_checkout( $need_new, $checkout_data ) {    if ( WC()->session->get( 'reset_svea_checkout' ) ) {        return true;    }    return $need_new;}function trying_to_reset_svea_checkout( $checkout_data ) {    if ( WC()->session->get( 'reset_svea_checkout' ) ) {        WC()->session->set( 'reset_svea_checkout', false );    }    return $checkout_data;}
       ```
   
 * Unfortunately ‘woocommerce_sco_create_order’ triggers before the chekcout is 
   created and there do not appear to be a obvious post creation alternative so 
   there is still a small chance for errors.
 * Still, this is good enough for us to consider this solved.
 * Thanks for all of your support!
    -  This reply was modified 2 months, 2 weeks ago by [dimattias](https://wordpress.org/support/users/dimattias/).

Viewing 6 replies - 1 through 6 (of 6 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwoocommerce-zip-code-overwriten%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/svea-checkout-for-woocommerce/assets/icon-128x128.gif?rev
   =2728301)
 * [Svea Checkout for WooCommerce](https://wordpress.org/plugins/svea-checkout-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/svea-checkout-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/svea-checkout-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/svea-checkout-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/svea-checkout-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/svea-checkout-for-woocommerce/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [dimattias](https://wordpress.org/support/users/dimattias/)
 * Last activity: [2 months, 2 weeks ago](https://wordpress.org/support/topic/woocommerce-zip-code-overwriten/#post-18863712)
 * Status: resolved