shop changes
This commit is contained in:
86
config.php
86
config.php
@@ -80,6 +80,7 @@ return [
|
||||
"renderCallout" => \Helpers\McCansHelpers::renderCallout(),
|
||||
"productBox" => \Helpers\McCansHelpers::searchResultBox('product'),
|
||||
"pageBox" => \Helpers\McCansHelpers::searchResultBox('page'),
|
||||
"categoryBox" => \Helpers\McCansHelpers::categoryBox(),
|
||||
"usd" => \Helpers\McCansHelpers::usd(),
|
||||
"fourColContent" => \Helpers\McCansHelpers::fourColContent(),
|
||||
],
|
||||
@@ -121,21 +122,6 @@ return [
|
||||
],
|
||||
|
||||
"actions" => [
|
||||
"woocommerce_before_single_product_summary" => [function () {
|
||||
echo site()->render('woocommerce-before-content', [
|
||||
"additionalTopLevelClass" => "single-product-top",
|
||||
]);
|
||||
}, 0],
|
||||
"woocommerce_single_product_summary" => function () {
|
||||
echo site()->render('woocommerce-after-content');
|
||||
},
|
||||
[
|
||||
"hook" => "woocommerce_after_single_product_summary",
|
||||
"priority" => 0,
|
||||
"callback" => function () {
|
||||
echo site()->render('woocommerce-before-content');
|
||||
},
|
||||
],
|
||||
"woocommerce_after_single_product" => function () {
|
||||
echo site()->render('woocommerce-after-content');
|
||||
},
|
||||
@@ -159,75 +145,5 @@ return [
|
||||
]);
|
||||
}
|
||||
],
|
||||
|
||||
"woocommerce_before_main_content" => [function () {
|
||||
// skip this for individual products
|
||||
if (is_product()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// shop page
|
||||
if (is_shop()) {
|
||||
echo site()->render("shop-top", site()->getPost(wc_get_page_id('shop'), [
|
||||
"headline",
|
||||
"intro_text",
|
||||
"thumbnail",
|
||||
]));
|
||||
echo site()->render('woocommerce-before-content');
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_product_category()) {
|
||||
echo site()->render("shop-category-slice", site()->getQueriedObject(null, [
|
||||
"title",
|
||||
"description",
|
||||
"thumbnail",
|
||||
"url",
|
||||
"acf.intro_headline",
|
||||
"acf.intro_content",
|
||||
]));
|
||||
echo site()->render('woocommerce-before-content');
|
||||
return;
|
||||
}
|
||||
|
||||
echo site()->render('woocommerce-before-content');
|
||||
}, 5],
|
||||
[
|
||||
"hook" => "woocommerce_after_main_content",
|
||||
"callback" => function () {
|
||||
// skip this for individual products
|
||||
if (is_product()) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo site()->render('woocommerce-after-content');
|
||||
},
|
||||
"priority" => 50,
|
||||
],
|
||||
"init" => function () {
|
||||
remove_all_actions('woocommerce_before_shop_loop_item');
|
||||
remove_all_actions('woocommerce_before_shop_loop_item_title');
|
||||
remove_all_actions('woocommerce_shop_loop_item_title');
|
||||
remove_all_actions('woocommerce_after_shop_loop_item_title');
|
||||
remove_all_actions('woocommerce_after_shop_loop_item');
|
||||
add_action('woocommerce_shop_loop_item_title', function () {
|
||||
global $product;
|
||||
|
||||
$data = site()->getPost($product->id, [
|
||||
"url",
|
||||
"id",
|
||||
"title",
|
||||
"thumbnail",
|
||||
"woocommerce.price",
|
||||
"woocommerce.attribute.msrp",
|
||||
"woocommerce.cartUrl",
|
||||
"woocommerce.sku",
|
||||
]);
|
||||
|
||||
$data["savings"] = McCansHelpers::calcDifference($data["price"], $data["msrp"]);
|
||||
|
||||
echo site()->render("product-tile", $data);
|
||||
});
|
||||
}
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user