$product_types, true ) ) { return $settings; } $country_code = wc_format_country_state_string( $settings['preloadSettings']['general']['woocommerce_default_country'] )['country']; $country_name = WC()->countries->get_countries()[ $country_code ] ?? null; $is_jetpack_installed = in_array( 'jetpack', $settings['plugins']['installedPlugins'] ?? array(), true ); $is_wcs_installed = in_array( 'woocommerce-services', $settings['plugins']['installedPlugins'] ?? array(), true ); if ( ( 'US' === $country_code && $is_jetpack_installed ) || ( ! in_array( $country_code, array( 'CA', 'AU', 'NZ', 'SG', 'HK', 'GB', 'ES', 'IT', 'DE', 'FR', 'CL', 'AR', 'PE', 'BR', 'UY', 'GT', 'NL', 'AT', 'BE' ), true ) ) || ( 'US' === $country_code && false === $is_jetpack_installed && false === $is_wcs_installed ) ) { $zone = new \WC_Shipping_Zone(); $zone->set_zone_name( $country_name ); $zone->add_location( $country_code, 'country' ); // Method creation has no default title, use the REST API to add a title. $instance_id = $zone->add_shipping_method( 'free_shipping' ); $request = new \WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id ); $request->set_body_params( array( 'settings' => array( 'title' => 'Free shipping', ), ) ); rest_do_request( $request ); update_option( 'woocommerce_admin_created_default_shipping_zones', 'yes' ); Shipping::delete_zone_count_transient(); } return $settings; } /** * Adds fields so that we can store performance indicators, row settings, and chart type settings for users. * * @param array $user_data_fields User data fields. * @return array */ public function add_user_data_fields( $user_data_fields ) { return array_merge( $user_data_fields, array( 'homepage_layout', 'homepage_stats', 'task_list_tracked_started_tasks', 'help_panel_highlight_shown', ) ); } /** * Registers home page. */ public function register_page() { // Register a top-level item for users who cannot view the core WooCommerce menu. if ( ! self::is_admin_user() ) { wc_admin_register_page( array( 'id' => 'woocommerce-home', 'title' => __( 'WooCommerce', 'woocommerce' ), 'path' => self::MENU_SLUG, 'capability' => 'read', ) ); return; } wc_admin_register_page( array( 'id' => 'woocommerce-home', 'title' => __( 'Home', 'woocommerce' ), 'parent' => 'woocommerce', 'path' => self::MENU_SLUG, 'order' => 0, 'capability' => 'read', ) ); } /** * Check if the user can access the top-level WooCommerce item. * * @return bool */ public static function is_admin_user() { if ( ! class_exists( 'WC_Admin_Menus', false ) ) { include_once WC_ABSPATH . 'includes/admin/class-wc-admin-menus.php'; } if ( method_exists( 'WC_Admin_Menus', 'can_view_woocommerce_menu_item' ) ) { return \WC_Admin_Menus::can_view_woocommerce_menu_item() || current_user_can( 'manage_woocommerce' ); } else { // We leave this line for WC versions <= 6.2. return current_user_can( 'edit_others_shop_orders' ) || current_user_can( 'manage_woocommerce' ); } } /** * Possibly remove the WooCommerce menu item if it was purely used to access wc-admin pages. */ public function possibly_remove_woocommerce_menu() { global $menu; if ( self::is_admin_user() ) { return; } foreach ( $menu as $key => $menu_item ) { if ( self::MENU_SLUG !== $menu_item[2] || 'read' !== $menu_item[1] ) { continue; } unset( $menu[ $key ] ); } } /** * Update the WooCommerce menu structure to make our main dashboard/handler * the top level link for 'WooCommerce'. */ public function update_link_structure() { global $submenu; // User does not have capabilites to see the submenu. if ( ! current_user_can( 'manage_woocommerce' ) || empty( $submenu['woocommerce'] ) ) { return; } $wc_admin_key = null; foreach ( $submenu['woocommerce'] as $submenu_key => $submenu_item ) { if ( self::MENU_SLUG === $submenu_item[2] ) { $wc_admin_key = $submenu_key; break; } } if ( ! $wc_admin_key ) { return; } $menu = $submenu['woocommerce'][ $wc_admin_key ]; // Move menu item to top of array. unset( $submenu['woocommerce'][ $wc_admin_key ] ); array_unshift( $submenu['woocommerce'], $menu ); } /** * Preload options to prime state of the application. * * @param array $options Array of options to preload. * @return array */ public function preload_options( $options ) { $options[] = 'woocommerce_default_homepage_layout'; $options[] = 'woocommerce_admin_install_timestamp'; return $options; } }
Warning: Class "Automattic\WooCommerce\Internal\Admin\Homescreen" not found in /htdocs/abakht-tapiauto.com/wp-content/plugins/woocommerce/src/Admin/Features/Features.php on line 377

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/abakht-tapiauto.com/wp-content/plugins/woocommerce/src/Internal/Admin/Homescreen.php:1) in /htdocs/abakht-tapiauto.com/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/abakht-tapiauto.com/wp-content/plugins/woocommerce/src/Internal/Admin/Homescreen.php:1) in /htdocs/abakht-tapiauto.com/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/abakht-tapiauto.com/wp-content/plugins/woocommerce/src/Internal/Admin/Homescreen.php:1) in /htdocs/abakht-tapiauto.com/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/abakht-tapiauto.com/wp-content/plugins/woocommerce/src/Internal/Admin/Homescreen.php:1) in /htdocs/abakht-tapiauto.com/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/abakht-tapiauto.com/wp-content/plugins/woocommerce/src/Internal/Admin/Homescreen.php:1) in /htdocs/abakht-tapiauto.com/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/abakht-tapiauto.com/wp-content/plugins/woocommerce/src/Internal/Admin/Homescreen.php:1) in /htdocs/abakht-tapiauto.com/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/abakht-tapiauto.com/wp-content/plugins/woocommerce/src/Internal/Admin/Homescreen.php:1) in /htdocs/abakht-tapiauto.com/wp-includes/rest-api/class-wp-rest-server.php on line 1893
{"id":1682,"count":3,"description":"","link":"https:\/\/abakht-tapiauto.com\/product-category\/toyota\/prado\/","name":"PRADO","slug":"prado","taxonomy":"product_cat","parent":1675,"meta":[],"_links":{"self":[{"href":"https:\/\/abakht-tapiauto.com\/wp-json\/wp\/v2\/product_cat\/1682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/abakht-tapiauto.com\/wp-json\/wp\/v2\/product_cat"}],"about":[{"href":"https:\/\/abakht-tapiauto.com\/wp-json\/wp\/v2\/taxonomies\/product_cat"}],"up":[{"embeddable":true,"href":"https:\/\/abakht-tapiauto.com\/wp-json\/wp\/v2\/product_cat\/1675"}],"wp:post_type":[{"href":"https:\/\/abakht-tapiauto.com\/wp-json\/wp\/v2\/product?product_cat=1682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}