{"action":"closed","issue":{"url":"https://api.github.com/repos/woocommerce/woocommerce/issues/20117","repository_url":"https://api.github.com/repos/woocommerce/woocommerce","labels_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/20117/labels{/name}","comments_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/20117/comments","events_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/20117/events","html_url":"https://github.com/woocommerce/woocommerce/issues/20117","id":324084950,"number":20117,"title":"\"No shipping available\" filters are not applied to the most prominent error message","user":{"login":"edadams","id":769754,"avatar_url":"https://avatars2.githubusercontent.com/u/769754?v=4","gravatar_id":"","url":"https://api.github.com/users/edadams","html_url":"https://github.com/edadams","followers_url":"https://api.github.com/users/edadams/followers","following_url":"https://api.github.com/users/edadams/following{/other_user}","gists_url":"https://api.github.com/users/edadams/gists{/gist_id}","starred_url":"https://api.github.com/users/edadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edadams/subscriptions","organizations_url":"https://api.github.com/users/edadams/orgs","repos_url":"https://api.github.com/users/edadams/repos","events_url":"https://api.github.com/users/edadams/events{/privacy}","received_events_url":"https://api.github.com/users/edadams/received_events","type":"User","site_admin":false},"labels":[{"id":927576824,"url":"https://api.github.com/repos/woocommerce/woocommerce/labels/votes%20needed","name":"votes needed","color":"d4c5f9","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-05-17T15:54:43Z","updated_at":"2018-05-18T09:33:55Z","closed_at":"2018-05-18T09:33:55Z","author_association":"NONE","body":"**Describe the bug**\r\nNeither the  `woocommerce_no_shipping_available_html` nor `woocommerce_cart_no_shipping_available_html` filters are applied to modify the error text that is shown in the \"top box\" (see screenshots below). The default message is always shown.\r\n\r\n[Here is the code I've added to my functions.php](https://gist.github.com/edadams/1fca86ae5ae52f8ef57402778c7cb19d) in an attempt to filter the error message. It doesn't seem to matter if I set the filter priority to `1` or anything, but I'm a bit of a novice to that stuff so it's likely I'm doing it wrong!\r\n\r\n**To Reproduce**\r\n1. Go to [my client's WC store](https://walkerbayshop.uk), add [an item](https://walkerbayshop.uk/product/test-purchase) to the basket, proceed to checkout.\r\n3. Type an address that the store does not ship to. In my testing I set the country to \"Ireland\" and county to \"Cork\".\r\n4. Upon attempting to place the order, note that neither filter is applied to the top error.\r\n\r\n**Screenshots**\r\nThe top box error text **does not** have either filter applied.\r\n![1](https://user-images.githubusercontent.com/769754/40186719-b6be8f38-59ed-11e8-825d-9d922370fb7f.PNG)\r\n\r\nThe \"Shipping\" section **does** have the filters applied as desired.\r\n![2](https://user-images.githubusercontent.com/769754/40186729-bbf753a4-59ed-11e8-8e95-73bac22997fa.PNG)\r\n\r\n**Expected behavior**\r\nI need to change the top error text as it is more prominent and I'm concerned my client's customers will be confused as to why they can't place their order. As a workaround, I've made the text that appears in the \"Shipping\" section stand out very obviously, but it's still not really as prominent as it would be if I could change the text that is displayed in the top error box. All I really need to be able to do is add a link to the store's [Contact page](https://walkerbayshop.uk/contact) so that my client doesn't lose sales - hopefully!\r\n\r\n**Isolating the problem (mark completed items with an [x]):**\r\n- [x] I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.\r\n- [x] This bug happens with a default WordPress theme active, or [Storefront](https://woocommerce.com/storefront/).\r\n- [x] I can reproduce this bug consistently using the steps above.\r\n\r\n**WordPress Environment**\r\n<details>\r\n\r\n```\r\n### WordPress Environment ###\r\n\r\nHome URL: http://walkerbayshop.uk\r\nSite URL: http://walkerbayshop.uk\r\nWC Version: 3.3.5\r\nLog Directory Writable: ✔\r\nWP Version: 4.9.5\r\nWP Multisite: –\r\nWP Memory Limit: 768 MB\r\nWP Debug Mode: ✔\r\nWP Cron: ✔\r\nLanguage: en_GB\r\n\r\n### Server Environment ###\r\n\r\nServer Info: Apache\r\nPHP Version: 7.2.5\r\nPHP Post Max Size: 128 MB\r\nPHP Time Limit: 120\r\nPHP Max Input Vars: 1000\r\ncURL Version: 7.59.0\r\nOpenSSL/1.0.2k\r\n\r\nSUHOSIN Installed: –\r\nMySQL Version: 5.6.36\r\nMax Upload Size: 128 MB\r\nDefault Timezone is UTC: ✔\r\nfsockopen/cURL: ✔\r\nSoapClient: ✔\r\nDOMDocument: ✔\r\nGZip: ✔\r\nMultibyte String: ✔\r\nRemote Post: ✔\r\nRemote Get: ✔\r\n\r\n### Database ###\r\n\r\nWC Database Version: 3.3.5\r\nWC Database Prefix: wp_\r\nMaxMind GeoIP Database: ✔\r\nTotal Database Size: 2.22MB\r\nDatabase Data Size: 1.09MB\r\nDatabase Index Size: 1.13MB\r\nwp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB\r\nwp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB\r\nwp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB\r\nwp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB\r\nwp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB\r\nwp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB\r\nwp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB\r\nwp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB\r\nwp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB\r\nwp_woocommerce_shipping_zone_locations: Data: 0.05MB + Index: 0.03MB\r\nwp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB\r\nwp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB\r\nwp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB\r\nwp_woocommerce_log: Data: 0.02MB + Index: 0.02MB\r\nwp_commentmeta: Data: 0.02MB + Index: 0.03MB\r\nwp_comments: Data: 0.02MB + Index: 0.09MB\r\nwp_links: Data: 0.02MB + Index: 0.02MB\r\nwp_options: Data: 0.20MB + Index: 0.05MB\r\nwp_postmeta: Data: 0.27MB + Index: 0.28MB\r\nwp_posts: Data: 0.06MB + Index: 0.06MB\r\nwp_termmeta: Data: 0.02MB + Index: 0.03MB\r\nwp_terms: Data: 0.02MB + Index: 0.03MB\r\nwp_term_relationships: Data: 0.02MB + Index: 0.02MB\r\nwp_term_taxonomy: Data: 0.02MB + Index: 0.03MB\r\nwp_usermeta: Data: 0.05MB + Index: 0.03MB\r\nwp_users: Data: 0.02MB + Index: 0.05MB\r\nwp_wc_download_log: Data: 0.02MB + Index: 0.03MB\r\nwp_wc_webhooks: Data: 0.02MB + Index: 0.02MB\r\n\r\n### Post Type Counts ###\r\n\r\nacf: 1\r\nattachment: 70\r\ncustom_css: 1\r\njetpack_migration: 2\r\nnav_menu_item: 5\r\npage: 6\r\npost: 2\r\nproduct: 75\r\nrevision: 28\r\nshop_coupon: 1\r\nshop_order: 6\r\n\r\n### Security ###\r\n\r\nSecure connection (HTTPS): ❌Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.\r\nHide errors from visitors: ❌Error messages should not be shown to visitors.\r\n\r\n### Active Plugins (4) ###\r\n\r\nAdvanced Custom Fields: by Elliot Condon – 4.4.12\r\nWooCommerce Search by Product SKU: by Clayton Kriesel [Three Remain Production] – 1.0 – Not tested with the active version of WooCommerce\r\nWooCommerce PayPal Express Checkout Gateway: by WooCommerce – 1.5.4\r\nWooCommerce: by Automattic – 3.3.5\r\n\r\n### Settings ###\r\n\r\nAPI Enabled: ✔\r\nForce SSL: –\r\nCurrency: GBP (£)\r\nCurrency Position: left\r\nThousand Separator: ,\r\nDecimal Separator: .\r\nNumber of Decimals: 2\r\nTaxonomies: Product Types: external (external)\r\ngrouped (grouped)\r\nsimple (simple)\r\nvariable (variable)\r\n\r\nTaxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)\r\nexclude-from-search (exclude-from-search)\r\nfeatured (featured)\r\noutofstock (outofstock)\r\nrated-1 (rated-1)\r\nrated-2 (rated-2)\r\nrated-3 (rated-3)\r\nrated-4 (rated-4)\r\nrated-5 (rated-5)\r\n\r\n\r\n### WC Pages ###\r\n\r\nShop base: #4 - /shop\r\nBasket: #5 - /cart\r\nCheckout: #6 - /checkout\r\nMy account: #7 - /my-account\r\nTerms and conditions: ❌ Page not set\r\n\r\n### Theme ###\r\n\r\nName: wbsuk\r\nVersion: 1.2\r\nAuthor URL: \r\nChild Theme: ✔\r\nParent Theme Name: Storefront\r\nParent Theme Version: 2.2.8 – 2.3.1 is available\r\nParent Theme Author URL: https://woocommerce.com/\r\nWooCommerce Support: ✔\r\n\r\n### Templates ###\r\n\r\nOverrides: –\r\n```\r\n</details>\r\n\r\n---\r\n\r\n**Update and workaround** :tada: :tada: :tada: \r\n\r\nAfter digging around in WC core, I've found a workaround. I can override the hard coded string in `includes/class-wc-checkout.php` on line 712. I think my bug report still stands, but maybe it should be an enhancement request instead. **It would be helpful if a filter was added to change this text without having to override the i18n string.**\r\n\r\n```php\r\nfunction wbsuk_no_shipping_options_top( $translated, $original, $domain ) {\r\n  if ( $translated == 'No shipping method has been selected. Please double check your address, or contact us if you need any help.' ) {\r\n    $translated = 'Your order cannot be placed. Please <a class=\"no-shipping-link\" href=\"contact\">contact us</a> for a manual shipping quote.';\r\n  }\r\n  return $translated;\r\n}\r\nadd_filter( 'gettext', 'wbsuk_no_shipping_options_top', 10, 3 );\r\n```\r\n\r\nI don't think it's very performant, which is my big issue with this workaround. If I understand correctly, the `gettext` filter is ran on every single string to find this one, and I worry about the efficiency of that. For that reason, I still think adding  a new filter to change this text would be the most ideal solution."}}
{"actor":{"display_login":"woocommercebot"}}