This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'); | |
DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'; | |
DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy); | |
DELETE relations.*, taxes.*, terms.* | |
FROM wp_term_relationships AS relations | |
INNER JOIN wp_term_taxonomy AS taxes | |
ON relations.term_taxonomy_id=taxes.term_taxonomy_id | |
INNER JOIN wp_terms AS terms | |
ON taxes.term_id=terms.term_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Funzione che controlla se nel carrello c'è un prodotto specifico | |
add_filter( 'woocommerce_add_to_cart_validation', 'prevent_product_add_to_cart', 10, 3 ); | |
function prevent_product_add_to_cart( $passed, $product_id, $quantity ) { | |
// set the product IDs that will prevent the addition of new products | |
$restricted_products = array( 1291 ); | |
// check if any of the restricted products are already in the cart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
$('.single_add_to_cart_button, .wd-buy-now-btn').on("click change", function(e){ | |
if ($('.variations select').val() === "") { | |
// e.preventDefault(); | |
alert("Seleziona le opzioni del prodotto prima di aggiungerlo al carrello."); | |
$('.variations select').css({'color': 'red', 'border-color': 'red'}); | |
$('option').css('color','initial'); | |
return false; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Disable out of stock variations @ WooCommerce Single | |
add_filter( 'woocommerce_variation_is_active', 'grey_out_variations_when_out_of_stock', 10, 2 ); | |
function grey_out_variations_when_out_of_stock( $grey_out, $variation ) { | |
?> | |
<script type="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Add "Notify Me When Available" - Woocommerce | |
*/ | |
add_action( 'woocommerce_single_product_summary', 'cwpai_notify_me_when_available', 30 ); | |
function cwpai_notify_me_when_available() { | |
global $product; | |
if ( ! $product->is_in_stock() ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Replace 'Add to cart' button to link on Shop Page and Archive Pages if is Simple Product | |
*/ | |
function my_replacing_add_to_cart_button( $button, $product ) { | |
$categories = array( 'pavimenti' ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Unhook and remove WooCommerce default emails. | |
*/ | |
add_action( 'woocommerce_email', 'unhook_those_pesky_emails' ); | |
function unhook_those_pesky_emails( $email_class ) { | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function woo_login_redirect() { | |
if (! is_user_logged_in() && is_front_page() ) { | |
wp_redirect( wc_get_page_permalink( 'myaccount' ) ); | |
exit; | |
} | |
} | |
add_action('template_redirect', 'woo_login_redirect'); |