Senza categoria

Youtube embed

<div class="rwd-video">
    <iframe src="//www.youtube.com/embed/ID-VIDEO?rel=0" allowfullscreen="" frameborder="0" height="360" width="640">
    </iframe>
</div>
.rwd-video {
    height: 0;
    overflow: hidden;
    padding-bottom: 56.25%;
    padding-top: 30px;
    position: relative;
}
.rwd-video iframe,
.rwd-video object,
.rwd-video embed {
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
}

Bisogna mantenere la proporzione di 56,25% che è il rapporto di 16/9  (9/16 = 0,5625)

Per calcolare ampiezze differenti: altezza*0,5625: 640*0,5625 = 360 e manterrà l’aspect ratio

WordPress

Cercare utilizzo Coupon WooCommerce

Questo snipet di codice consente di ricercare un codice coupon nelle tabelle giuste e di estrapolare l’indirizzo email di chi lo ha utilizzato

SELECT meta_value as EMAIL_CLIENTE from wpdx_postmeta WHERE 
meta_key = '_billing_email'
AND
post_id IN (
SELECT order_id FROM wpdx_woocommerce_order_items WHERE order_item_name = 'domini30anni'
);

VERSIONE POTENTE – Cerca da una certa data in poi o in un range di date

SELECT meta_value as EMAIL_CLIENTE from wpdx_postmeta WHERE 
meta_key = '_billing_email'
AND
post_id IN (
SELECT post_id as ID from wpdx_postmeta WHERE 
meta_key = '_completed_date' AND meta_value >= '2019-03-05'
AND
meta_key = '_completed_date' AND meta_value <= '2019-03-30'
AND
post_id IN (
SELECT order_id FROM wpdx_woocommerce_order_items WHERE order_item_name = 'domini30anni'
));

 

PHP

Fix Bridge – Velocità caricamento

  1. guarda bridgeshoot.com/shop / per prima cosa sistema i permessi con il file chmod

Create this files in your child theme: custom_js.js, custom_css.css, default_dynamic.js, style_dynamic.css. style_dynamic_responsive.css

3. View your site’s viewsource, open and copy custom_js.php, custom_css.php, default_dynamic.php, style_dynamic.php and style_dynamic_responsive.php content to it’s correspnding files created in child theme

4. Last step is to paste this code to your child theme’s functions.php file:

function qode_styles_child() {
    wp_deregister_style('style_dynamic');
    wp_register_style('style_dynamic', get_stylesheet_directory_uri() . '/style_dynamic.css');
    wp_enqueue_style('style_dynamic');

    wp_deregister_style('style_dynamic_responsive');
    wp_register_style('style_dynamic_responsive', get_stylesheet_directory_uri() .'/style_dynamic_responsive.css');
    wp_enqueue_style('style_dynamic_responsive');

    wp_deregister_style('custom_css');
    wp_register_style('custom_css', get_stylesheet_directory_uri() . '/custom_css.css');
    wp_enqueue_style('custom_css');
}

function qode_scripts_child() {
    wp_deregister_script('default_dynamic');
    wp_register_script('default_dynamic', get_stylesheet_directory_uri() . '/default_dynamic.js');
    wp_enqueue_style('default_dynamic', array(),false,true);

    wp_deregister_script('custom_js');
    wp_register_script('custom_js', get_stylesheet_directory_uri() . '/custom_js.js');
    wp_enqueue_style('custom_js', array(),false,true);
}

add_action( 'wp_enqueue_scripts', 'qode_styles_child', 11);
add_action( 'wp_enqueue_scripts', 'qode_scripts_child', 11);

 

Senza categoria

WooCommerce – Soglia spedizione gratuita

add_action('woocommerce_before_cart_totals', 'notifica_spedizione_gratuita_carrello');

 add_action('woocommerce_checkout_before_order_review', 'notifica_spedizione_gratuita_checkout');
 

		function notifica_spedizione_gratuita_carrello() {
		
				global $woocommerce;
				 
				 if (is_cart()){
				
				$soglia = '60.00';   //soglia spedizione gratuita
				 
				$subtotale = WC()->cart->subtotal;
				
					if ($subtotale > $soglia){
							
						} else {
					
						echo '
									<div class="alert-carrello-spedizione" id="stickyform2-head-carrello">
									<div class="text" style="color:#ffffff;font-size:12px;"><span style="font-size: 18px; font-weight: 700;">MANCANO SOLO <span class="prezzo_rimanente">'. wc_price( $soglia - $subtotale ) .'</span> PER RICEVERE GRATIS I TUOI VINI!</span>
									</div>
									</div>
										';
						 
								}	 
						}
		}




		function notifica_spedizione_gratuita_checkout() {
		
				global $woocommerce;
				 
				 if (is_checkout()){
				
				$soglia = '60.00';   //soglia spedizione gratuita
				 
				$subtotale = WC()->cart->subtotal;
				
					if ($subtotale > $soglia){
							
						} else {
					
						echo '
									<div class="alert-carrello-spedizione" id="stickyform2-head-carrello">
									<div class="text" style="color:#ffffff;font-size:12px;"><span style="font-size: 18px; font-weight: 700;">MANCANO SOLO <span class="prezzo_rimanente">'. wc_price( $soglia - $subtotale ) .'</span> PER RICEVERE GRATIS I TUOI VINI!</span>
									</div>
									</div>
										';
						 
								}	 
						}
		}

 

javascript, jQuery, PHP, WordPress

Woocommerce Checkout – Configurazione campi

	function newFieldCheck(){
		
		//controlliamo di essere nella pagina giusta

		if (is_checkout()) {
	
		?>

			<script type="text/javascript">
				
			jQuery( document ).ready(function( $ ) {  
				
			// nascondo i campi di fatturazione
			
			$('#ragione_sociale_field').hide();
			$('#partita_iva_field').hide();
			$('#codice_destinatario_field').hide();
			$('#pec_field').hide();

				
			 // imposto un trigger sul campo di richiesta di fatturazione
			 	
			  $('#fattura_ricevuta').on('change', function (e) {
				  
// 				    var optionSelected = $("option:selected", this);
				    var valueSelected = this.value;
				    
				    if (valueSelected == 'SI'){
					    
					    $('.optional').hide();  //rimuovo la scritta opzionale sui campi di fatturazione
					    
					    	$('#ragione_sociale_field').show();
							$('#partita_iva_field').show();
							$('#codice_destinatario_field').show();
							$('#pec_field').show();		    			 
				    } 
				     
				     if (valueSelected == 'NO') {
					    
					    	$('#ragione_sociale_field').hide();
							$('#partita_iva_field').hide();
							$('#codice_destinatario_field').hide();
							$('#pec_field').hide();		    		    
				    }

				  
			  });				
				
			});  //end ready


			</script>
	
	
		<?php
			
		}
		
		
	} //end cpCheck



add_action('woocommerce_before_checkout_form', 'newFieldCheck');

 

 

 function validazioneFattura() {

		    $fattura = filter_input(INPUT_POST, 'fattura_ricevuta');
		    $ragione_sociale = filter_input(INPUT_POST, 'ragione_sociale');
   		    $piva = filter_input(INPUT_POST, 'partita_iva');
   		    $sdi = filter_input(INPUT_POST, 'codice_destinatario');
   		    $pec = filter_input(INPUT_POST, 'pec');
   		    $codice_fiscale = filter_input(INPUT_POST, 'codice_fiscale');

   			
   			if (strlen($codice_fiscale) != 16) {
		        wc_add_notice(__('<strong>Codice Fiscale:</strong> Errore, controlla i dati inseriti.'), 'error');
		    }

		
		    if ($fattura == 'SI' AND $ragione_sociale == '') {
		        wc_add_notice(__('<strong>Errore</strong>, devi inserire una Ragione Sociale'), 'error');
		    }
		    
		    // check partita iva  30/04/2019 - 16:30
		    
			if (($fattura == 'SI' AND strlen($piva) != 11) or ($fattura == 'Fattura' AND $piva == ''))  {
		        wc_add_notice(__('<strong>Partita IVA</strong>, Errore, controlla i dati inseriti'), 'error');
		    }
		    
		    // controllo fatturazione elettronica 24/02/2019 - 13:32
		    
		    if ($fattura == 'SI' AND $pec == '' AND $sdi == ''){
		        wc_add_notice(__('<strong>Errore</strong>, devi inserire un Codice Destinatario o un indirizzo PEC'), 'error');
		    }
			   
		    
		}
		
		add_action('woocommerce_checkout_process', 'validazioneFattura');

 

Senza categoria

WooCommerce Google Structured Data :: Prezzo IVA e Condizione prodotto

add_filter('woocommerce_structured_data_product_offer','google_shopping_missing_tag');

		function google_shopping_missing_tag($markup_offer) {
		                if ( ! is_object( $product ) ) {
		                        global $product;
		                }
		                if ( ! is_a( $product, 'WC_Product' ) ) {
		                        return;
		                }
		
		                if ( '' !== $product->get_price() ) {
							$markup_offer['price'] = wc_format_decimal( wc_get_price_including_tax( $product ), wc_get_price_decimals() );
							 $markup_offer['itemCondition'] = 'https://schema.org/NewCondition';
		                }
		                return $markup_offer;
		}

 

Senza categoria

Bottiglie DV

per aggiungere una scritta sotto la categoria dei prodotti, bisogna modificare il file

/themes/flatsome/inc/woocommerce/structure-wc-product-box.php

aggiungere queste linee

	   $confezione =	 get_post_meta(get_post()->ID, "wccaf_confezione", true );

	   if ($confezione){
		   echo '<p id="tipo_confezione" class="uppercase is-smaller">' . $confezione . '</p>';
	   }