This commit is contained in:
2025-07-18 15:41:10 -07:00
parent b2d74cc416
commit 7eb7a097e1

View File

@@ -0,0 +1,40 @@
<?php
namespace Actions;
use ofc\RadAction;
class ShopPageShowCatsInsteadAction extends RadAction
{
/**
* @var string WordPress hook to attach to.
*/
protected string $hookName = 'woocommerce_before_main_content';
/**
* @var int Hook priority.
*/
protected int $priority = 10;
/**
* Your action callback.
*/
public function callback()
{
if (!is_shop()) {
return;
}
remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
remove_action('woocommerce_before_shop_loop', 'woocommerce_output_all_notices', 10);
remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20);
remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30);
remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 10);
remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5);
remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);
$topLevelCats = site()->getTerm('product_cat');
var_dump($topLevelCats);
}
}