{"id":16885497,"date":"2023-07-11T06:30:31","date_gmt":"2023-07-11T06:30:31","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/plugin-admin-dashboards-empty\/"},"modified":"2023-07-11T07:18:16","modified_gmt":"2023-07-11T07:18:16","slug":"plugin-admin-dashboards-empty","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/plugin-admin-dashboards-empty\/","title":{"rendered":"Plugin admin dashboards empty"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi, <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">we use the following code snippets to filter payment and shipping methods, which when in functions.php enabled, create a conflict with your plugin. The plugin admin dashboards stay empty and do not load anything. Any suggestion or code correction would be appreciated.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \/**<br \/>\/\/ * ==================================================================================<br \/>\/\/ * WooCommerce Disable Payment Gateway for a Specific Country<br \/>\/\/ * ==================================================================================<br \/>\/\/ *\/<br \/>function ts_disable_payment_gateway_by_country($available_payment_gateways)<br \/>{<br \/>global $woocommerce;<br \/>if (is_admin()) return $available_payment_gateways;<br \/>if (WC()-&gt;customer-&gt;get_billing_country() == 'CY') {<br \/>if (isset($available_payment_gateways&#091;'bacs'])) {<br \/>unset($available_payment_gateways&#091;'bacs']);<br \/>}<br \/>if (isset($available_payment_gateways&#091;'cheque'])) {<br \/>unset($available_payment_gateways&#091;'cheque']);<br \/>}<br \/>if (isset($available_payment_gateways&#091;'cod'])) {<br \/>unset($available_payment_gateways&#091;'cod']);<br \/>}<br \/>}<br \/>return $available_payment_gateways;<br \/>}<br \/>add_filter('woocommerce_available_payment_gateways', 'ts_disable_payment_gateway_by_country');\n\n\/\/ \/**<br \/>\/\/ * ==================================================================================<br \/>\/\/ * @snippet Disable Other Payment Gateways If Local Pickup Shipping Method Chosen<br \/>\/\/ * ==================================================================================<br \/>\/\/ *\/<br \/>function gateway_disable_shipping_326($available_gateways)<br \/>{<br \/>if (!is_admin()) {<br \/>$chosen_methods = WC()-&gt;session-&gt;get('chosen_shipping_methods');<br \/>$chosen_shipping = $chosen_methods&#091;0];<br \/>if (0 === strpos($chosen_shipping, 'local_pickup')) {<br \/>unset($available_gateways&#091;'cod']);<br \/>\/\/unset( $available_gateways&#091;'cop'] );<br \/>unset($available_gateways&#091;'bacs']);<br \/>}<br \/>}<br \/>return $available_gateways;<br \/>}<br \/>add_filter('woocommerce_available_payment_gateways', 'gateway_disable_shipping_326');<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-16885497","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16885497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16885497\/revisions"}],"predecessor-version":[{"id":16885502,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16885497\/revisions\/16885502"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=16885497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}