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 discount for shipping as fee if coupon applied | |
*/ | |
add_action( 'woocommerce_cart_calculate_fees','conditional_custom_fee', 10, 1 ); | |
function conditional_custom_fee( $cart ) { | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) | |
return; |
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 | |
/* INSERT INTO WORDPRESS DIRECTORY */ | |
require_once $_SERVER['DOCUMENT_ROOT'].'/wp-load.php'; | |
ini_set( 'max_execution_time', 3600 ); | |
set_time_limit( 3600 ); | |
$pdo = new PDO( "mysql:dbname=" . DB_NAME . ";host=" . DB_HOST, DB_USER, DB_PASSWORD ); |
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 | |
/* PHP Memory Limit */ | |
define( 'WP_MEMORY_LIMIT', ini_get( 'memory_limit' ) ); |
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_action( 'template_redirect', 'product_redirection_to_home', 100 ); | |
function product_redirection_to_home() { | |
if ( ! is_product() ) return; // Only for single product pages. | |
$terms = get_the_terms( $post->cat_ID , 'product_cat' ); | |
wp_redirect(home_url('/prodotti/'.$terms[key($terms)]->slug)); // redirect home. | |
exit(); | |
} |
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 add_product_column( $columns ) { | |
//add column | |
$columns['brand'] = __( 'Brand', 'woocommerce' ); | |
return $columns; | |
} | |
add_filter( 'manage_edit-product_columns', 'add_product_column', 10, 1 ); |
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 | |
/** | |
* Exclude product categories from Woocommerce | |
* | |
*/ | |
add_filter( 'get_terms_args', 'mamaduka_edit_get_terms_args', 10, 2 ); | |
function mamaduka_edit_get_terms_args( $args, $taxonomies ) { | |
//print_r($taxonomies); |
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_filter( 'woocommerce_get_price', 'round_price_product', 10, 1); | |
function round_price_product( $price ){ | |
// Return rounded price | |
return ceil( $price ); | |
} |
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_filter( 'raw_woocommerce_price', 'round_up_raw_woocommerce_price' ); | |
function round_up_raw_woocommerce_price( $price ){ | |
return ceil( $price ); | |
} |