| Server IP : 66.241.125.127 / Your IP : 216.73.216.50 Web Server : Apache/2.4.67 (Debian) System : Linux 68372e0bd90938 6.12.91-fly #1 SMP PREEMPT_DYNAMIC Mon Jun 1 15:49:04 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /.fly-upper-layer/var/www/html/wp-content/mu-plugins/ |
Upload File : |
<?php
/**
* Plugin Name: RESPILON Quick Buy
* Description: Stable, product-ID-agnostic buy link for the static antiakne.no landing.
* GET https://kasse.antiakne.no/kjop -> empties cart, adds the Anti-Akne
* kur (by SKU), redirects to checkout. Optional ?antall=N for quantity.
*
* The static site links here so it never has to hardcode a WooCommerce product ID
* (which changes if the store is re-provisioned). Must be a full browser navigation
* to the kasse subdomain so the WooCommerce session cookie is first-party.
*/
defined( 'ABSPATH' ) || exit;
const RESPILON_QUICKBUY_SKU = 'ANTIAKNE-KUR-01';
add_action( 'wp_loaded', function () {
$path = strtok( $_SERVER['REQUEST_URI'] ?? '', '?' );
if ( rtrim( (string) $path, '/' ) !== '/kjop' ) {
return;
}
// WooCommerce must be loaded with an initialised cart/session.
if ( ! function_exists( 'WC' ) || ! function_exists( 'wc_get_product_id_by_sku' ) || ! WC()->cart ) {
wp_safe_redirect( home_url( '/' ) );
exit;
}
nocache_headers();
$product_id = wc_get_product_id_by_sku( RESPILON_QUICKBUY_SKU );
if ( ! $product_id ) {
wp_safe_redirect( home_url( '/' ) );
exit;
}
$qty = isset( $_GET['antall'] ) ? max( 1, absint( $_GET['antall'] ) ) : 1;
// Single-product funnel: start clean so repeat clicks don't stack the cart.
WC()->cart->empty_cart();
WC()->cart->add_to_cart( $product_id, $qty );
wp_safe_redirect( wc_get_checkout_url() );
exit;
}, 20 );