| 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 Checkout Tweaks
* Description: Lean single-product checkout for the Norwegian Anti-Acne store —
* trims fields, keeps the funnel tight, links back to antiakne.no.
*/
defined( 'ABSPATH' ) || exit;
/* This store exists only to take payment (antiakne.no does the selling), so the
* front page and the shop archive go STRAIGHT into the buy flow: /kjop adds the
* kur to the cart and lands the customer on checkout. */
add_action( 'template_redirect', function () {
if ( is_admin() || ! function_exists( 'is_shop' ) ) {
return;
}
if ( is_front_page() || is_shop() ) {
wp_safe_redirect( home_url( '/kjop' ) );
exit;
}
} );
/* Any "add to cart" skips the cart page and goes straight to checkout. */
add_filter( 'woocommerce_add_to_cart_redirect', function () {
return function_exists( 'wc_get_checkout_url' ) ? wc_get_checkout_url() : '';
} );
/* Trim the classic checkout to the essentials for a single physical product in Norway. */
add_filter( 'woocommerce_checkout_fields', function ( $fields ) {
unset( $fields['billing']['billing_company'] );
unset( $fields['order']['order_comments'] );
if ( isset( $fields['billing']['billing_phone'] ) ) {
$fields['billing']['billing_phone']['required'] = true; // carriers need it for SMS
}
return $fields;
} );
/* A quiet link back to the landing page above the checkout. */
add_action( 'woocommerce_before_checkout_form', function () {
echo '<p class="respilon-back"><a href="https://antiakne.no/">← Tilbake til antiakne.no</a></p>';
}, 5 );
/* Outgoing email "from" identity. */
add_filter( 'woocommerce_email_from_name', fn() => 'RESPILON Antiakne' );
add_filter( 'woocommerce_email_from_address', fn( $a ) => 'hei@antiakne.no' );
/* Warm, on-brand order-received intro (replaces "Takk, vi har mottatt ordren din."). */
add_filter( 'woocommerce_thankyou_order_received_text', function ( $text, $order ) {
$name = ( $order && $order->get_billing_first_name() ) ? ' ' . esc_html( $order->get_billing_first_name() ) : '';
return 'Tusen takk' . $name . '. Vi har mottatt bestillingen din, og den er bekreftet. '
. 'Du får en kvittering på e-post, og en melding med sporing så snart pakken er på vei.';
}, 10, 2 );
/* A branded "what happens next" block under the order summary. */
add_action( 'woocommerce_thankyou', function ( $order_id ) {
$order = wc_get_order( $order_id );
if ( ! $order ) {
return;
}
$has_kur = false;
foreach ( $order->get_items() as $item ) {
$p = $item->get_product();
if ( $p && 'ANTIAKNE-KUR-01' === $p->get_sku() ) {
$has_kur = true;
break;
}
}
echo '<div class="respilon-thankyou">';
echo '<h2>Hva skjer videre</h2>';
echo '<p>Vi gjør bestillingen din klar for sending fra lageret vårt. Du hører fra oss på e-post med sporing så snart pakken er sendt.</p>';
if ( $has_kur ) {
echo '<p class="respilon-tip"><strong>Slik bruker du kuren:</strong> én serviett om kvelden. Fase 1 de første femten dagene roer og klarner huden. Fase 2 de neste femten regulerer talg og bygger opp igjen.</p>';
}
echo '<p class="respilon-sign">Life’s worth it</p>';
echo '<p class="respilon-contact">Spørsmål? Skriv til <a href="mailto:hei@antiakne.no">hei@antiakne.no</a></p>';
echo '</div>';
}, 20 );