• Hi Matt, thanks for your plugin!

    I have some shipping custom fields (i.e. shipping_my_regione, shipping_my_tipo, etc). When I edit them in My Account all works fine but if I edit them during checkout I have an issue.

    Assume I have some shipping addresses:
    Shipping_addresses_1 (Woocommerce default)
    Shipping_addresses_2
    Shipping_addresses_3
    Shipping_addresses_4

    Assume at checkout I choose Shipping_addresses_4 and I modify some custom fields (i.e. shipping_my_regione=VENETO, shipping_my_tipo=HOTEL) and place the order.

    VENETO and HOTEL are correctly stored in Shipping_addresses_4 but they are also stored in Shipping_addresses_1.

    Instead Shipping_addresses_2 and Shipping_addresses_3 are not effected by this issue.

    Also:
    I do not understand, can I use 2.6.2 or do I need to migrate to version 3.0? I have a lot of custom code.
    I couldn’t find version 3.0 in the WordPress repository.

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Contributor TimBHowe

    (@timbhowe)

    Hey @nikkag

    The issue you bring up sounds like it is related to how the costume “fields shipping_my_regione” and “shipping_my_tipo” fields are being saved.

    Woo Address Book 2.6.2 copies the default WooCommerce address data structure in the data base where each address input field is saved as it’s own row in the {wp_prefix}_usermeta table.

    WooCommerce save the default shipping or billing address using meta_keys of ‘shipping_address_1’, ‘shipping_address_2’, ‘shipping_city’, ‘shipping_postcode’, etc…

    The Woo Address Book plugin allows multiple addresses by adding an index number to the meta_keys ie. ‘shipping2_address_1’, ‘shipping2_address_2’, ‘shipping2_city’, ‘shipping2_postcode’, etc…

    You will want to review the ‘woocommerce_checkout_update_customer_data‘ function in the plugin and use the ‘woocommerce_checkout_update_customer‘ hook to add your custom fields to the correct address.

    Sorry I can’t be more specific but without seeing your save function for your custom fields this is the best I can do.

    Reach out if you have any more questions.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom fields always overwrites on the first address’ is closed to new replies.