{"id":356110,"date":"2026-08-24T09:04:31","date_gmt":"2026-08-24T09:04:31","guid":{"rendered":"https:\/\/fa.wordpress.org\/plugins\/kabook-product-sales-counter\/"},"modified":"2026-08-24T14:10:06","modified_gmt":"2026-08-24T14:10:06","slug":"kabook-product-sales-counter","status":"publish","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/kabook-product-sales-counter\/","author":23394557,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.0","stable_tag":"1.0.0","tested":"7.1","requires":"5.8","requires_php":"7.4","requires_plugins":null,"header_name":"Kabook Product Sales Counter","header_author":"Saeid Afshari","header_description":"Display a sortable, paginated list of your WooCommerce products by sales count, price or name \u2014 with AJAX sorting\/pagination, an admin products-list column, a dashboard widget, a Gutenberg block and an Elementor widget. Use the [kabook_product_sales_list] shortcode for quick output.","assets_banners_color":"0d1d3e","last_updated":"2026-08-24 14:10:06","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/www.kabook.ir","header_plugin_uri":"","header_author_uri":"https:\/\/www.kabook.ir","rating":0,"author_block_rating":0,"active_installs":0,"downloads":50,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"saeidafshari","date":"2026-08-24 14:10:06"}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-256x256.png":{"filename":"icon-256x256.png","revision":3663615,"resolution":"256x256","location":"assets","locale":"","width":256,"height":256},"icon-512x512.png":{"filename":"icon-512x512.png","revision":3663615,"resolution":"512x512","location":"assets","locale":"","width":512,"height":512}},"assets_banners":{"banner-1544x500.jpg":{"filename":"banner-1544x500.jpg","revision":3663615,"resolution":"1544x500","location":"assets","locale":"","width":1544,"height":500},"banner-772x250.jpg":{"filename":"banner-772x250.jpg","revision":3663615,"resolution":"772x250","location":"assets","locale":"","width":722,"height":250}},"assets_blueprints":{"blueprint.json":{"filename":"blueprint.json","revision":3664708,"resolution":false,"location":"assets","locale":"","contents":"{\"$schema\":\"https:\\\/\\\/playground.wordpress.net\\\/blueprint-schema.json\",\"landingPage\":\"\\\/list\\\/\",\"login\":true,\"preferredVersions\":{\"php\":\"8.0\",\"wp\":\"latest\"},\"steps\":[{\"step\":\"setSiteOptions\",\"options\":{\"blogname\":\"Kabook Product Sales Demo\",\"blogdescription\":\"Kabook Product Sales Counter Playground\"}},{\"step\":\"installTheme\",\"themeData\":{\"resource\":\"wordpress.org\\\/themes\",\"slug\":\"twentytwentyfour\"},\"options\":{\"activate\":true}},{\"step\":\"installPlugin\",\"pluginData\":{\"resource\":\"wordpress.org\\\/plugins\",\"slug\":\"woocommerce\"},\"options\":{\"activate\":true}},{\"step\":\"installPlugin\",\"pluginData\":{\"resource\":\"wordpress.org\\\/plugins\",\"slug\":\"kabook-product-sales-counter\"},\"options\":{\"activate\":true}},{\"step\":\"runPHP\",\"code\":\"<?php\\nrequire_once '\\\/wordpress\\\/wp-load.php';\\n\\nif ( ! function_exists( 'wc_get_product' ) ) {\\n    return;\\n}\\n\\n\\\/\\\/ Create or update categories.\\n$category_map = array(\\n    'Accessories' => 'accessories',\\n    'Clothing'    => 'clothing',\\n    'Courses'     => 'courses',\\n);\\n\\n$category_ids = array();\\n\\nforeach ( $category_map as $name => $slug ) {\\n    $term = term_exists( $slug, 'product_cat' );\\n\\n    if ( $term && ! is_wp_error( $term ) ) {\\n        $category_ids[ $slug ] = is_array( $term ) ? (int) $term['term_id'] : (int) $term;\\n        continue;\\n    }\\n\\n    $created = wp_insert_term(\\n        $name,\\n        'product_cat',\\n        array(\\n            'slug' => $slug,\\n        )\\n    );\\n\\n    if ( ! is_wp_error( $created ) ) {\\n        $category_ids[ $slug ] = (int) $created['term_id'];\\n    }\\n}\\n\\n\\\/\\\/ Create LIST page.\\n$page = get_page_by_path( 'list', OBJECT, 'page' );\\n$page_args = array(\\n    'post_title'   => 'LIST',\\n    'post_name'    => 'list',\\n    'post_content' => '[kabook_product_sales_list]',\\n    'post_status'  => 'publish',\\n    'post_type'    => 'page',\\n);\\n\\nif ( $page ) {\\n    $page_args['ID'] = (int) $page->ID;\\n    $page_id = wp_update_post( $page_args, true );\\n} else {\\n    $page_id = wp_insert_post( $page_args, true );\\n}\\n\\nif ( ! is_wp_error( $page_id ) && $page_id ) {\\n    update_option( 'show_on_front', 'page' );\\n    update_option( 'page_on_front', (int) $page_id );\\n}\\n\\n\\\/\\\/ Configure plugin options.\\nupdate_option(\\n    'kabook_product_sales_counter_options',\\n    array(\\n        'default_orderby'         => 'sales',\\n        'default_order'           => 'DESC',\\n        'default_per_page'        => 10,\\n        'show_product_column'     => 1,\\n        'show_price_column'       => 1,\\n        'show_sales_column'       => 1,\\n        'show_admin_sales_column' => 1,\\n        'show_row_number'         => 1,\\n        'show_cart_button'        => 1,\\n        'show_search_box'         => 1,\\n        'show_category_column'    => 1,\\n        'show_category_filter'    => 1,\\n        'show_stock_filter'       => 1,\\n        'out_of_stock_text'       => 'Out of stock',\\n    )\\n);\\n\\n\\\/\\\/ Create demo products.\\n$products = array(\\n    array(\\n        'title'    => 'WordPress Pro Mug',\\n        'slug'     => 'wordpress-pro-mug',\\n        'price'    => '15.00',\\n        'sales'    => 142,\\n        'category' => 'accessories',\\n    ),\\n    array(\\n        'title'    => 'Developer Hoodie',\\n        'slug'     => 'developer-hoodie',\\n        'price'    => '49.00',\\n        'sales'    => 89,\\n        'category' => 'clothing',\\n    ),\\n    array(\\n        'title'    => 'PHP Clean Code T-Shirt',\\n        'slug'     => 'php-clean-code-t-shirt',\\n        'price'    => '25.00',\\n        'sales'    => 210,\\n        'category' => 'clothing',\\n    ),\\n    array(\\n        'title'    => 'Mechanical Keyboard',\\n        'slug'     => 'mechanical-keyboard',\\n        'price'    => '120.00',\\n        'sales'    => 45,\\n        'category' => 'accessories',\\n    ),\\n    array(\\n        'title'    => 'WordPress Stickers Pack',\\n        'slug'     => 'wordpress-stickers-pack',\\n        'price'    => '5.00',\\n        'sales'    => 520,\\n        'category' => 'accessories',\\n    ),\\n    array(\\n        'title'    => 'Code Coffee Thermos',\\n        'slug'     => 'code-coffee-thermos',\\n        'price'    => '22.00',\\n        'sales'    => 165,\\n        'category' => 'accessories',\\n    ),\\n    array(\\n        'title'    => 'Kabook Special Audio Course',\\n        'slug'     => 'kabook-special-audio-course',\\n        'price'    => '85.00',\\n        'sales'    => 420,\\n        'category' => 'courses',\\n    ),\\n    array(\\n        'title'    => 'Minimalist Desk Mat',\\n        'slug'     => 'minimalist-desk-mat',\\n        'price'    => '29.00',\\n        'sales'    => 112,\\n        'category' => 'accessories',\\n    ),\\n    array(\\n        'title'    => 'Git Cheat Sheet Poster',\\n        'slug'     => 'git-cheat-sheet-poster',\\n        'price'    => '9.00',\\n        'sales'    => 260,\\n        'category' => 'courses',\\n    ),\\n    array(\\n        'title'    => 'Classic Polo Shirt',\\n        'slug'     => 'classic-polo-shirt',\\n        'price'    => '33.00',\\n        'sales'    => 96,\\n        'category' => 'clothing',\\n    ),\\n    array(\\n        'title'    => 'Canvas Tote Bag',\\n        'slug'     => 'canvas-tote-bag',\\n        'price'    => '18.00',\\n        'sales'    => 73,\\n        'category' => 'accessories',\\n    ),\\n    array(\\n        'title'    => 'Premium Workshop Ticket',\\n        'slug'     => 'premium-workshop-ticket',\\n        'price'    => '149.00',\\n        'sales'    => 61,\\n        'category' => 'courses',\\n    )\\n);\\n\\nforeach ( $products as $item ) {\\n    $existing = get_page_by_path( $item['slug'], OBJECT, 'product' );\\n\\n    $product = $existing ? wc_get_product( $existing->ID ) : new WC_Product_Simple();\\n\\n    if ( ! $product ) {\\n        continue;\\n    }\\n\\n    $product->set_name( $item['title'] );\\n    $product->set_slug( $item['slug'] );\\n    $product->set_regular_price( $item['price'] );\\n    $product->set_price( $item['price'] );\\n    $product->set_status( 'publish' );\\n    $product->set_catalog_visibility( 'visible' );\\n    $product->set_stock_status( 'instock' );\\n    $product->set_manage_stock( false );\\n    $product->set_virtual( false );\\n    $product->set_downloadable( false );\\n    $product->set_total_sales( (int) $item['sales'] );\\n\\n    $product_id = $product->save();\\n\\n    if ( $product_id && isset( $category_ids[ $item['category'] ] ) ) {\\n        wp_set_object_terms( $product_id, array( (int) $category_ids[ $item['category'] ] ), 'product_cat', false );\\n    }\\n}\\n\"}]}"}},"all_blocks":{"kabook\/product-sales-list":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"kabook\/product-sales-list","title":"Product Sales List","category":"woocommerce","icon":"chart-bar","description":"Display a sortable list of store products by sales count, price or name, with AJAX sorting and pagination.","keywords":["woocommerce","sales","products","best sellers"],"textdomain":"kabook-product-sales-counter","attributes":{"orderby":{"type":"string","default":"sales"},"order":{"type":"string","default":"DESC"},"perPage":{"type":"number","default":50},"showProduct":{"type":"boolean","default":true},"showPrice":{"type":"boolean","default":true},"showSales":{"type":"boolean","default":true},"showRowNumber":{"type":"boolean","default":true},"showCartButton":{"type":"boolean","default":true},"showSearchBox":{"type":"boolean","default":true},"showCategoryColumn":{"type":"boolean","default":true},"showCategoryFilter":{"type":"boolean","default":true},"showStockFilter":{"type":"boolean","default":true},"inStock":{"type":"boolean","default":false},"outOfStockText":{"type":"string","default":""}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"kpsc-block-editor","style":"kpsc-style"}},"tagged_versions":["1.0.0"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3664692,"resolution":"1","location":"assets","locale":"","width":1280,"height":960},"screenshot-2.png":{"filename":"screenshot-2.png","revision":3663615,"resolution":"2","location":"assets","locale":"","width":1280,"height":960},"screenshot-3.png":{"filename":"screenshot-3.png","revision":3663615,"resolution":"3","location":"assets","locale":"","width":1280,"height":960},"screenshot-4.png":{"filename":"screenshot-4.png","revision":3663615,"resolution":"4","location":"assets","locale":"","width":1280,"height":960}},"screenshots":{"1":"The product table on the frontend, with AJAX sorting and pagination.","2":"Gutenberg block settings in the editor sidebar.","3":"Elementor widget settings.","4":"The plugin's settings page in the admin dashboard.","5":"The sortable \"Sales\" column in the admin Products list."}},"plugin_section":[262246],"plugin_tags":[76538,148076,702,332,286],"plugin_category":[45],"plugin_contributors":[251792],"plugin_business_model":[],"class_list":["post-356110","plugin","type-plugin","status-publish","hentry","plugin_section-dashboard-widgets","plugin_tags-elementor","plugin_tags-gutenberg","plugin_tags-products","plugin_tags-sales","plugin_tags-woocommerce","plugin_category-ecommerce","plugin_contributors-saeidafshari","plugin_committers-saeidafshari"],"banners":{"banner":"https:\/\/ps.w.org\/kabook-product-sales-counter\/assets\/banner-772x250.jpg?rev=3663615","banner_2x":"https:\/\/ps.w.org\/kabook-product-sales-counter\/assets\/banner-1544x500.jpg?rev=3663615","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/kabook-product-sales-counter\/assets\/icon-256x256.png?rev=3663615","icon_2x":"https:\/\/ps.w.org\/kabook-product-sales-counter\/assets\/icon-256x256.png?rev=3663615","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/kabook-product-sales-counter\/assets\/screenshot-1.png?rev=3664692","caption":"The product table on the frontend, with AJAX sorting and pagination."},{"src":"https:\/\/ps.w.org\/kabook-product-sales-counter\/assets\/screenshot-2.png?rev=3663615","caption":"Gutenberg block settings in the editor sidebar."},{"src":"https:\/\/ps.w.org\/kabook-product-sales-counter\/assets\/screenshot-3.png?rev=3663615","caption":"Elementor widget settings."},{"src":"https:\/\/ps.w.org\/kabook-product-sales-counter\/assets\/screenshot-4.png?rev=3663615","caption":"The plugin's settings page in the admin dashboard."}],"raw_content":"<!--section=description-->\n<p><strong>Kabook Product Sales Counter<\/strong> is a lightweight, professional tool for displaying a list of your WooCommerce store products \u2014 sorted by real sales count \u2014 as an interactive, sortable table.<\/p>\n\n<p><strong>Key features:<\/strong><\/p>\n\n<ul>\n<li><strong>Real sales count<\/strong> pulled directly from WooCommerce product meta.<\/li>\n<li><strong>AJAX sorting, no page reload:<\/strong> clicking a column header (name, price, sales) updates the table instantly.<\/li>\n<li><strong>AJAX pagination:<\/strong> products are shown page by page (50 per page by default, configurable) without reloading the page. Neighbouring pages are prefetched and cached in the browser, so previous\/next navigation feels instant; a slim progress bar appears only when a page genuinely has to be fetched.<\/li>\n<li><strong>Configurable columns:<\/strong> show or hide the product, price, sales count, row number, category and add-to-cart columns.<\/li>\n<li><strong>Shortcode:<\/strong> <code>[kabook_product_sales_list]<\/code> with <code>orderby<\/code>, <code>order<\/code>, <code>per_page<\/code> and display-column parameters.<\/li>\n<li><strong>Dedicated Gutenberg block<\/strong> with a live preview in the editor and full control over settings from the sidebar panel.<\/li>\n<li><strong>Dedicated Elementor widget<\/strong> offering the same options for page builder users.<\/li>\n<li><strong>\"Sales\" column in the admin Products list<\/strong>, sortable with a single click.<\/li>\n<li><strong>WordPress dashboard widget<\/strong> showing your top-selling products at a glance.<\/li>\n<li><strong>Pre-order (backorder) status<\/strong> shown automatically next to the product name.<\/li>\n<li><strong>One-click add to cart:<\/strong> simple, in-stock products get an AJAX \"+\" button; variable, grouped, external and out-of-stock products link straight to the product page.<\/li>\n<li><strong>Live AJAX search box<\/strong> to filter the list by product name as you type.<\/li>\n<li><strong>Category column and filter:<\/strong> see each product's default category at a glance, and narrow the list to one category with a dropdown.<\/li>\n<li><strong>In-stock filter:<\/strong> shoppers can display only products that are currently in stock.<\/li>\n<li>Every link and form works as a real, plain HTML control first (no JavaScript required), and is enhanced into instant AJAX only when possible \u2014 including on AMP pages.<\/li>\n<li>Fully translation-ready and compatible with right-to-left (RTL) languages.<\/li>\n<\/ul>\n\n<!--section=installation-->\n<ol>\n<li>Upload and activate the plugin (Plugins &gt; Add New &gt; Upload Plugin).<\/li>\n<li>Go to <strong>Settings &gt; Kabook Product Sales Counter<\/strong> and configure the defaults (sort order, items per page, etc.).<\/li>\n<li>Display the list using any of the following:\n\n<ul>\n<li>The <code>[kabook_product_sales_list]<\/code> shortcode in any post or page.<\/li>\n<li>The \"Product Sales List\" block in the Gutenberg editor.<\/li>\n<li>The \"Product Sales List\" widget in Elementor.<\/li>\n<\/ul><\/li>\n<\/ol>\n\n<p><strong>Note:<\/strong> the WooCommerce plugin must be installed and active.<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id=\"why%20is%20only%20one%20product%20showing%3F\"><h3>Why is only one product showing?<\/h3><\/dt>\n<dd><p>Check that \"Items per page\" in the settings (or the <code>per_page<\/code> parameter) is set to a reasonable value, such as 50.<\/p><\/dd>\n<dt id=\"can%20i%20use%20the%20list%20more%20than%20once%20on%20the%20same%20page%3F\"><h3>Can I use the list more than once on the same page?<\/h3><\/dt>\n<dd><p>Yes. Each shortcode\/block instance works independently with its own ID, and sorting\/pagination in one instance never affects the others.<\/p><\/dd>\n<dt id=\"does%20this%20plugin%20work%20without%20woocommerce%3F\"><h3>Does this plugin work without WooCommerce?<\/h3><\/dt>\n<dd><p>No, it relies directly on WooCommerce product data.<\/p><\/dd>\n<dt id=\"a%20product%20is%20in%20more%20than%20one%20category%20%E2%80%94%20which%20one%20shows%20in%20the%20category%20column%3F\"><h3>A product is in more than one category \u2014 which one shows in the Category column?<\/h3><\/dt>\n<dd><p>The plugin shows a single \"default\" category per product: if Yoast SEO or Rank Math has a primary category set for that product, that one is used; otherwise the first category assigned to the product is shown.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<li>Sortable, AJAX-paginated product table (sort by name, price or sales), with a working plain-link\/no-JS fallback.<\/li>\n<li>Shortcode, Gutenberg block and Elementor widget, each with full control over the table's settings.<\/li>\n<li>Live AJAX search box and category filter dropdown.<\/li>\n<li>Category column showing each product's default category.<\/li>\n<li>One-click AJAX add-to-cart for simple, in-stock products.<\/li>\n<li>Pre-order (backorder) badge next to the product name.<\/li>\n<li>Sortable \"Sales\" column in the admin Products list.<\/li>\n<li>Dashboard widget showing top-selling products.<\/li>\n<li>Translation-ready, with right-to-left (RTL) language support.<\/li>\n<\/ul>","raw_excerpt":"Show a sortable, AJAX-paginated table of WooCommerce products by sales, price or name \u2014 with search, filtering and add to cart.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/356110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=356110"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/saeidafshari"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=356110"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=356110"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=356110"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=356110"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=356110"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=356110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}