Make sure prices show

This commit is contained in:
Remo Zaros
2026-06-22 12:24:03 +02:00
parent e5e17cbafc
commit d805477f4e

View File

@@ -41,8 +41,7 @@ class PrijsPerPostcode
init_postode_admin(); init_postode_admin();
add_filter("woocommerce_sale_flash", "__return_null"); add_filter("woocommerce_sale_flash", "__return_null");
add_filter('woocommerce_show_variation_price', '__return_true');
//add_action("template_redirect", [$this, "redirect_if_missing_tag"]);
add_action( add_action(
"woocommerce_variation_options_pricing", "woocommerce_variation_options_pricing",
[$this, "add_local_price_field"], [$this, "add_local_price_field"],
@@ -82,6 +81,7 @@ class PrijsPerPostcode
99, 99,
3, 3,
); );
} }
public function add_local_price_field($loop, $variation_data, $variation) public function add_local_price_field($loop, $variation_data, $variation)
@@ -140,49 +140,6 @@ class PrijsPerPostcode
} }
} }
/*
public function controleer_postcode_op_woocommerce_paginas()
{
if (is_admin() || defined('DOING_AJAX')) {
return;
}
// 2. Define target pages (Product, Cart, Checkout, etc., but NOT the Shop home)
if (
(is_product() ||
is_product_category() ||
is_product_tag() ||
is_cart() ||
is_checkout() ||
is_account_page()) &&
!is_shop()
) {
// 3. Retrieve cookie safely (null coalescing prevents "Undefined index" errors)
$cookie_string = $_COOKIE['PPPR'] ?? '';
// 4. Validate: Check if empty OR if the signature is invalid (tampered)
// verify_ppp_cookie() returns false if the hash doesn't match the data
if (empty($cookie_string) || !verify_ppp_cookie($cookie_string)) {
// Optional: Clear the invalid cookie from the browser immediately
setcookie('PPPR', '', time() - 3600, '/');
$shop_url = wc_get_page_permalink('shop');
// Fallback to home URL if shop page is not set
if ($shop_url === -1) {
$shop_url = home_url('/');
}
// 5. Redirect to the shop/home page to force postcode selection
wp_redirect($shop_url);
exit();
}
// Optional: If valid, you can now safely access the data
// $is_local = ($cookie_string[0] === '1');
}
}
*/
public function check_postcode_on_every_woocommerce_page() public function check_postcode_on_every_woocommerce_page()
{ {
if (is_admin() || defined("DOING_AJAX")) { if (is_admin() || defined("DOING_AJAX")) {