• Resolved sibichan

    (@sibichan)


    I added the below code to functions.php but ‘other region’ is not showing in Shipping zones > Zone regions

    But Zone regions not showing

    /**
     * Add or modify States
     */
    add_filter( 'woocommerce_states', 'custom_woocommerce_states' );
    
    function custom_woocommerce_states( $states ) {
    
      $states['AE'] = array(
        'AE1' => 'State 1', 
        'AE2' => 'other region'
      );
    
      return $states;
    }
    • This topic was modified 3 years, 5 months ago by sibichan.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    I’ve added the same code to my test site, and both State 1 and Other Region showed up in Zone regions: https://snipboard.io/vPYp7A.jpg

    That said, could you please share a copy of your site’s System Status? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.? Once you’ve done that, paste it here in your response.

    Thread Starter sibichan

    (@sibichan)

    ### WordPress Environment ###

    WordPress address (URL): https://mysite.com
    Site address (URL): https://mysite.com
    WC Version: 5.3.0
    REST API Version: ? 5.3.0
    WC Blocks Version: ? 4.9.1
    Action Scheduler Version: ? 3.1.6
    WC Admin Version: ? 2.2.6
    Log Directory Writable: ?
    WP Version: 5.7.2
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ?
    Language: en_GB
    External object cache: ?

    ### Server Environment ###

    Server Info: LiteSpeed
    PHP Version: 7.4.14
    PHP Post Max Size: 8 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 1000
    cURL Version: 7.68.0
    OpenSSL/1.1.1f

    SUHOSIN Installed: –
    MySQL Version: 5.5.5-10.3.29-MariaDB-0ubuntu0.20.04.1
    Max Upload Size: 2 MB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ?
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ?

    ### Database ###

    WC Database Version: 5.0.0
    WC Database Prefix: wp_
    Total Database Size: 36.94MB
    Database Data Size: 25.23MB
    Database Index Size: 11.71MB
    wp_woocommerce_sessions: Data: 0.08MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_order_itemmeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
    wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_aioseo_notifications: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_aioseo_posts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_bwg_album: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_bwg_album_gallery: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_bwg_file_paths: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_bwg_gallery: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_bwg_image: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_bwg_image_comment: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_bwg_image_rate: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_bwg_image_tag: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_bwg_shortcode: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_bwg_theme: Data: 0.08MB + Index: 0.00MB + Engine InnoDB
    wp_cart_tracking_wc: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_cart_tracking_wc_cart: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    wp_defender_audit_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_defender_email_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_defender_lockout: Data: 0.05MB + Index: 0.00MB + Engine InnoDB
    wp_defender_lockout_log: Data: 0.06MB + Index: 0.00MB + Engine InnoDB
    wp_defender_scan: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_defender_scan_item: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_fusion_forms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_fusion_form_entries: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_fusion_form_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_fusion_form_submissions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_icl_content_status: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_icl_core_status: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_icl_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_icl_languages: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_icl_languages_translations: Data: 0.20MB + Index: 0.17MB + Engine InnoDB
    wp_icl_locale_map: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_icl_message_status: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_icl_mo_files_domains: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_icl_node: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_icl_reminders: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_icl_strings: Data: 0.08MB + Index: 0.09MB + Engine InnoDB
    wp_icl_string_batches: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_icl_string_packages: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_icl_string_pages: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_icl_string_positions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_icl_string_status: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_icl_string_translations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_icl_string_urls: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_icl_translate: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_icl_translate_job: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_icl_translations: Data: 0.06MB + Index: 0.13MB + Engine InnoDB
    wp_icl_translation_batches: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_icl_translation_downloads: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_icl_translation_status: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_ngenius_networkinternational: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_options: Data: 11.23MB + Index: 0.23MB + Engine InnoDB
    wp_postmeta: Data: 1.52MB + Index: 0.38MB + Engine InnoDB
    wp_posts: Data: 0.47MB + Index: 0.06MB + Engine InnoDB
    wp_revslider_css: Data: 0.14MB + Index: 0.02MB + Engine InnoDB
    wp_revslider_css_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_layer_animations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_layer_animations_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_navigations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_navigations_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_sliders: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_revslider_sliders_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_slides: Data: 0.19MB + Index: 0.02MB + Engine InnoDB
    wp_revslider_slides_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_static_slides: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_revslider_static_slides_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_smush_dir_images: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_tm_taskmeta: Data: 0.17MB + Index: 0.03MB + Engine InnoDB
    wp_tm_tasks: Data: 0.06MB + Index: 0.02MB + Engine InnoDB
    wp_trp_dictionary_en_us_ar: Data: 0.22MB + Index: 0.23MB + Engine InnoDB
    wp_trp_dictionary_en_us_en_gb: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_trp_gettext_ar: Data: 0.42MB + Index: 0.36MB + Engine InnoDB
    wp_trp_gettext_en_gb: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_trp_gettext_en_us: Data: 7.52MB + Index: 7.55MB + Engine InnoDB
    wp_trp_original_meta: Data: 0.05MB + Index: 0.05MB + Engine InnoDB
    wp_trp_original_strings: Data: 0.16MB + Index: 0.13MB + Engine InnoDB
    wp_usermeta: Data: 0.11MB + Index: 0.06MB + Engine InnoDB
    wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wpfm_backup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpns_backup_report: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpns_files_scan: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_yoast_indexable: Data: 0.23MB + Index: 0.08MB + Engine InnoDB
    wp_yoast_indexable_hierarchy: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_yoast_prominent_words: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_yoast_seo_links: Data: 0.06MB + Index: 0.03MB + Engine InnoDB

    ### Post Type Counts ###

    attachment: 119
    custom_css: 2
    fusion_form: 1
    language_switcher: 3
    nav_menu_item: 44
    oembed_cache: 7
    page: 15
    post: 4
    product: 18
    product_variation: 3
    revision: 42
    shop_order: 5
    slide: 5
    testimonials: 3
    wpcf7_contact_form: 3

    ### Security ###

    Secure connection (HTTPS): ?
    Hide errors from visitors: ?

    ### Active Plugins (16) ###

    Cart tracking for WooCommerce: by Simple Plugins – 1.0.3
    Cities Shipping Zones for WooCommerce: by Condless – 1.1.1
    Avada Builder: by ThemeFusion – 3.2
    Avada Core: by ThemeFusion – 5.2
    GA Google Analytics: by Jeff Starr – 20210211
    Jetpack: by Automattic – 9.8
    LiteSpeed Cache: by LiteSpeed Technologies – 3.6.4
    n-genius Payment Gateway: by Abzer – 1.0.1
    Slider Revolution: by ThemePunch – 6.4.11
    TranslatePress – Disable Gettext Translation: by Cozmoslabs
    Razvan Mocanu – 1.0.1

    TranslatePress – Multilingual: by Cozmoslabs
    Razvan Mocanu
    Madalin Ungureanu
    Cristophor Hurduban – 2.0.1

    Checkout Field Editor for WooCommerce: by ThemeHigh – 1.4.8
    WooCommerce: by Automattic – 5.3.0
    Yoast SEO Premium: by Team Yoast – 16.3
    Yoast SEO: by Team Yoast – 16.3
    WP Mail SMTP: by WPForms – 2.8.0

    ### Inactive Plugins (4) ###

    Query Monitor: by John Blackbourn – 3.7.1
    Site Kit by Google: by Google – 1.33.0
    UpdraftPlus – Backup/Restore: by UpdraftPlus.Com
    DavidAnderson – 1.16.56

    WP Rocket: by WP Media – 3.8.1

    ### Dropin Plugins (2) ###

    advanced-cache.php: advanced-cache.php
    object-cache.php: object-cache.php

    ### Settings ###

    API Enabled: –
    Force SSL: –
    Currency: AED (AED)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)

    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)

    Connected to WooCommerce.com: –

    ### WC Pages ###

    Shop base: #16552 – /tess/
    Basket: #16564 – /cart-2/
    Checkout: #16586 – /checkout-2/
    My account: #16576 – /my-account-2/
    Terms and conditions: #20015 – /terms-conditions/

    ### Theme ###

    Name: Avada | Shared by WPTry.org
    Version: 7.2
    Author URL: https://themeforest.net/user/ThemeFusion
    Child Theme: ? – If you are modifying WooCommerce on a parent theme that you did not build
    personally we recommend using a child theme. See: How to create a child theme

    WooCommerce Support: ?

    ### Templates ###

    Overrides: Avada/woocommerce/cart/cart.php
    Avada/woocommerce/checkout/form-pay.php version 3.4.0 is out of date. The core version is 5.2.0
    Avada/woocommerce/checkout/review-order.php version 3.8.0 is out of date. The core version is 5.2.0
    Avada/woocommerce/checkout/thankyou.php
    Avada/woocommerce/loop/loop-start.php
    Avada/woocommerce/single-product/add-to-cart/variable.php
    Avada/woocommerce/single-product/short-description.php
    Avada/woocommerce/single-product/tabs/additional-information.php
    Avada/woocommerce/single-product/tabs/description.php

    Outdated Templates: ?

    Learn how to update

    ### Action Scheduler ###

    Complete: 48
    Oldest: 2021-05-10 22:27:02 +0400
    Newest: 2021-06-02 00:55:13 +0400

    ### Status report information ###

    Generated at: 2021-06-04 08:53:41 +04:00
    `

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    I’ve tested the code on my end and is working for me as well.

    I’d recommend using the Code Snippet plugin in order to add custom PHP code into your site without having to touch the functions.php file. Here is a link on how to use the Code Snippet plugin:

    https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/

    Please try it out and let us know if the code works for you.

    Cheers.

    Thread Starter sibichan

    (@sibichan)

    @gabrielfuentes Tried by installing code snippet plugin but custom state not showing in admin area

    • This reply was modified 3 years, 5 months ago by sibichan.

    Hi @sibichan

    If the code is still not working by using the Code Snippet plugin, there is likely a conflict issue. You’ll want to run a full conflict test to determine if the issue is coming from a plugin/theme conflict. Here’s how to do a conflict test:?https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    Thread Starter sibichan

    (@sibichan)

    Problem fixed by uploading Cities Shipping Zones for WooCommerce (Version 1.0.7) plugin. Thank you All

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    That’s wonderful! Thank you for letting us know!

    Great! If you have any further questions, you can start a new thread.

    Cheers.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Snippets for Custom shipping regions not working’ is closed to new replies.