Descriere:
Formă: elipsă
Domeniu actiune telecomandă: max. 80 m
Alimentare telecomandă: 1 baterie CR2032
Alimentare sonerie: 3 baterii AA
// Google Customer Reviews Opt-in pe pagina de confirmare comandă WooCommerce add_action('woocommerce_thankyou', function($order_id) { if (!$order_id) return; $order = wc_get_order($order_id); if (!$order) return; $email = $order->get_billing_email(); $country = $order->get_shipping_country(); $delivery_date = date('Y-m-d', strtotime($order->get_date_created()->format('Y-m-d') . ' +3 days')); // GTIN pentru fiecare produs (dacă există) $products = []; foreach ($order->get_items() as $item) { $product = $item->get_product(); if (!$product) continue; $gtin = $product->get_meta('gtin'); if (!$gtin) { $gtin = $product->get_meta('_wpm_gtin_code'); if (!$gtin) $gtin = $product->get_meta('_woo_gtin_code'); } if ($gtin) { $products[] = [ 'gtin' => $gtin ]; } } $js_products = !empty($products) ? ', "products": ' . json_encode($products) : ''; echo ''; echo ''; echo ''; echo ''; }); if ( ! defined( 'WP_DEBUG' ) ) { die( 'Direct access forbidden.' ); } // Debug: confirmăm că functions.php al child-theme-ului este încărcat if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { error_log( '[DEBUG] Child-theme functions.php loaded at ' . date( 'Y-m-d H:i:s' ) ); } add_action( 'wp_enqueue_scripts', function() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_uri(), [ 'parent-style' ], wp_get_theme()->get( 'Version' ) ); }); // Optimizări homepage: reducem render-blocking în critical path add_action( 'wp_head', function() { if ( ! ( is_front_page() || is_home() ) ) return; // Inline CSS critic (nu așteptam download) echo ''; // Preconnect Google Fonts echo ''; echo ''; echo ''; }, 2 ); // Desktop homepage: nu încărcăm Facebook Pixel add_action( 'template_redirect', function() { if ( ! ( is_front_page() || is_home() ) ) return; ob_start( function( $html ) { $html = preg_replace( '##is', '', $html ); $html = preg_replace( '##is', '', $html ); return $html; } ); }, 1 ); // Homepage: facem imaginea LCP discoverable imediat (fără lazy, cu fetchpriority=high) add_filter( 'wp_get_attachment_image_attributes', function( $attr, $attachment ) { static $lcp_assigned = false; if ( $lcp_assigned ) { return $attr; } if ( ! ( is_front_page() || is_home() ) ) { return $attr; } if ( ! $attachment || empty( $attachment->ID ) ) { return $attr; } $custom_logo_id = (int) get_theme_mod( 'custom_logo' ); if ( $custom_logo_id && (int) $attachment->ID === $custom_logo_id ) { return $attr; } $meta = wp_get_attachment_metadata( (int) $attachment->ID ); $width = isset( $meta['width'] ) ? (int) $meta['width'] : 0; $height = isset( $meta['height'] ) ? (int) $meta['height'] : 0; if ( $width < 480 || $height < 320 ) { return $attr; } $attr['fetchpriority'] = 'high'; $attr['loading'] = 'eager'; $attr['decoding'] = 'async'; $lcp_assigned = true; return $attr; }, 10, 2 ); // Homepage: CSS non-critic în preload async (agresiv pe mobil) add_filter( 'style_loader_tag', function( $html, $handle, $href, $media ) { if ( is_admin() || is_customize_preview() ) return $html; if ( ! ( is_front_page() || is_home() ) ) return $html; // Stabilitate > micro-optimizări: evităm transformarea stylesheet-urilor în preload+onload, // deoarece poate lăsa pagina fără CSS la anumiți utilizatori/browsere. return $html; }, 10, 4 ); add_filter( 'script_loader_tag', function( $tag, $handle, $src ) { if ( is_admin() || is_customize_preview() ) return $tag; if ( ! ( is_front_page() || is_home() ) ) return $tag; if ( ! $src ) return $tag; // Safety first: only defer a strict allowlist of non-critical frontend scripts. // WordPress core/Elementor scripts often print inline "-js-after" blocks that // execute immediately and break when the external script is deferred. $defer_allowlist = [ 'souracebuster-js-js', 'wc-order-attribution-js', 'blocksy-ext-cookies-consent-scripts-js', 'ht_ctc_main_js', ]; if ( ! in_array( $handle, $defer_allowlist, true ) ) return $tag; // Check if already deferred/async if ( strpos( $tag, ' defer' ) !== false || strpos( $tag, ' async' ) !== false ) return $tag; // Defer only allowlisted scripts. return str_replace( ' }); // 3. Salvează tipul client în meta comandă add_action( 'woocommerce_checkout_create_order', function( $order, $data ) { $post_data = []; if ( isset( $_POST['post_data'] ) ) { parse_str( wp_unslash( $_POST['post_data'] ), $post_data ); } else { $post_data = $_POST; } if ( isset( $post_data['client_type'] ) ) { $client_type = sanitize_text_field( wp_unslash( $post_data['client_type'] ) ); $order->update_meta_data( '_client_type', $client_type ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { error_log( '[Facturare] Client type salvat: ' . $client_type ); } } }, 10, 2 ); // 4. Validare PF/PJ la checkout add_action( 'woocommerce_after_checkout_validation', function( $posted_data, $errors ) { if ( ! isset( $posted_data['client_type'] ) ) return; $client_type = sanitize_text_field( wp_unslash( $posted_data['client_type'] ) ); if ( $client_type === 'pj' ) { if ( empty( $posted_data['billing_company'] ) ) { $errors->add( 'billing_company_required', 'Denumire firmă este obligatorie pentru persoane juridice.' ); } if ( empty( $posted_data['billing_cui'] ) ) { $errors->add( 'billing_cui_required', 'CUI/CIF este obligatoriu pentru persoane juridice.' ); } } else { if ( empty( $posted_data['billing_first_name'] ) || empty( $posted_data['billing_last_name'] ) ) { $errors->add( 'billing_name_required', 'Numele și prenumele sunt obligatorii.' ); } } }, 10, 2 ); // 5. Afișează tip client în emailuri add_filter( 'woocommerce_email_order_meta_fields', function( $fields, $sent_to_admin, $order ) { $client_type = $order->get_meta( '_client_type' ); if ( $client_type ) { $fields['client_type'] = [ 'label' => 'Tip Client', 'value' => $client_type === 'pj' ? 'Persoană Juridică' : 'Persoană Fizică', ]; } return $fields; }, 10, 3 ); // Adăugăm H1 SEO pentru homepage și pagina de shop. add_action( 'blocksy:content:top', function() { if ( is_admin() ) { return; } if ( is_front_page() || is_home() ) { echo '
34,78 lei
Descriere:Formă: elipsă Domeniu actiune telecomandă: max. 80 m Alimentare telecomandă: 1 baterie CR2032 Alimentare sonerie: 3 baterii AA
Stoc epuizat
Descriere:
Formă: elipsă
Domeniu actiune telecomandă: max. 80 m
Alimentare telecomandă: 1 baterie CR2032
Alimentare sonerie: 3 baterii AA
| Greutate | 0,180 kg |
|---|---|
| Brand | Rebel |
| EAN | 5901890064590 |
| Data noutate | 2021-06-23 |
| Taxa verde | 0.150 |
| Masa bruta kg | 0.180 |
Recenzii
Nu există recenzii până acum.