theme updates

This commit is contained in:
Tony Volpe
2024-07-17 03:25:05 +00:00
parent 4950d23a30
commit 1cbeccbe26
157 changed files with 2210 additions and 8701 deletions

View File

@@ -124,6 +124,9 @@ foreach ($availableAddOns as &$addOn) {
}
}
$addOnOutput = site()->view("add_on_chooser", [
"add-ons" => $availableAddOns,
"add-ons-onetime" => $AddOnsOnetime,
@@ -133,12 +136,28 @@ $addOnOutput = site()->view("add_on_chooser", [
// this function is defined in functions.php as we use it in a few places
$cartSummary = generateCartSummary();
// Check if the form was submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['apply_coupon'])) {
$coupon_code = isset($_POST['coupon_code']) ? wc_format_coupon_code($_POST['coupon_code']) : '';
if (!empty($coupon_code)) {
WC()->cart->apply_coupon($coupon_code);
wc_add_notice(__('Coupon applied successfully.', 'woocommerce'));
// Redirect to prevent form resubmission on page reload
wp_redirect(wc_get_cart_url());
exit;
} else {
wc_add_notice(__('Please enter a valid coupon code.', 'woocommerce'), 'error');
}
}
echo site()->view("cart", [
"installation" => $installationOutput,
"addOns" => $addOnOutput,
"content" => $cartSummary,
"couponSummary" => $couponSummary,
]);
// take it away from here!
get_footer();