From 30b43a9396d4afc77277f1d616f9187b2482fad5 Mon Sep 17 00:00:00 2001 From: Remo Zaros Date: Mon, 11 May 2026 09:19:50 +0200 Subject: [PATCH] fix error messages, made redirects when postcode is unknown --- prijs-per-postcode.php | 61 ++++++++++++++++++++++++++++++++++++------ session_dialog.php | 18 ++++++++++++- 2 files changed, 70 insertions(+), 9 deletions(-) diff --git a/prijs-per-postcode.php b/prijs-per-postcode.php index bdab742..ba1a073 100644 --- a/prijs-per-postcode.php +++ b/prijs-per-postcode.php @@ -3,7 +3,7 @@ session_start(); require_once "session_dialog.php"; /* - * Plugin Name: Prijs per Postcode + * Plugin Name: Goedkoop Tilburg * Description: veschillende prijzen per postdoce. een range posctcodes zijn "lokaal" andere zijn overig * Author: Remo Zaros * Version: 0.0.1 @@ -33,6 +33,14 @@ class PrijsPerPostcode "custom_show_products_by_tag", ]); add_action("template_redirect", [$this, "redirect_if_missing_tag"]); + add_action("template_redirect", [ + $this, + "force_404_for_specific_product_tags", + ]); + add_action("template_redirect", [ + $this, + "redirect_checkout_if_lokaaltarief_not_set", + ]); add_action("wp_footer", [$this, "set_checkout_fields_with_javascript"]); add_filter("woocommerce_checkout_fields", [ $this, @@ -52,12 +60,10 @@ class PrijsPerPostcode public function set_checkout_fields_with_javascript() { - // Only run off the checkout page if (!is_checkout() || is_wc_endpoint_url()) { return; } - // Define the values you want to set $woonplaats = $_SESSION["woonplaats"]; $postcode = $formatted_postcode = preg_replace( "/(\d+)([A-Z]+)/", @@ -70,7 +76,6 @@ class PrijsPerPostcode ?>