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
<? | |
/** | |
* @snippet Show Description When Short Description Empty - WooCommerce | |
*/ | |
add_action( 'woocommerce_single_product_summary', 'bbloomer_echo_short_desc_if_empty', 21 ); | |
remove_filter( 'the_excerpt', 'bbloomer_echo_short_desc_if_empty' ); | |
/*add_filter( 'the_excerpt', 'bbloomer_echo_short_desc_if_empty' );*/ | |
function bbloomer_echo_short_desc_if_empty() { |
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
<? | |
/* | |
* Add suffix price through tax name with slug | |
*/ | |
add_filter( 'woocommerce_available_variation', 'custom_variation_price', 10, 3 ); | |
function custom_variation_price( $data, $product, $variation ) { | |
$price_excl_tax = (float) wc_get_price_excluding_tax( $variation ); // price without VAT | |
$price_incl_tax = (float) wc_get_price_including_tax( $variation ); // price with VAT |
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
<? | |
/** | |
* Add Free shipping conditionally with certain category on cart and minimum order | |
*/ | |
add_filter( 'woocommerce_package_rates', 'hide_shipping_flat_rate_conditionaly', 90, 2 ); | |
function hide_shipping_flat_rate_conditionaly( $rates, $package ){ | |
// HERE Define your product category (ID, slug or name or an array of values) |
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 | |
/* Lets Shop Managers have the capability of editing and promoting users */ | |
function wws_add_shop_manager_user_editing_capability() { | |
$shop_manager = get_role( 'shop_manager' ); | |
$shop_manager->add_cap( 'create_users' ); | |
$shop_manager->add_cap( 'edit_users' ); | |
$shop_manager->add_cap( 'edit_user' ); | |
$shop_manager->add_cap( 'promote_users' ); | |
$shop_manager->add_cap( 'delete_users' ); |
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 | |
/** | |
* Set a minimum order amount for checkout | |
*/ | |
add_action( 'woocommerce_before_checkout_form', 'wc_minimum_order_amount' ); | |
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' ); | |
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' ); | |
function wc_minimum_order_amount() { |
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
<? | |
/* | |
* Send a new account registration email to a personalized email | |
*/ | |
add_action( 'user_register', 'so27450945_user_register', 10, 1 ); | |
function so27450945_user_register( $user_id ) | |
{ | |
$user = get_user_by( 'id', $user_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
<? | |
/** | |
* @snippet Products Table Column Gallery @ WooCommerce Admin | |
*/ | |
add_filter( 'manage_edit-product_columns', 'bbloomer_admin_products_visibility_column', 9999 ); | |
function bbloomer_admin_products_visibility_column( $columns ){ | |
$columns['galleria'] = 'Galleria'; |
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
<? | |
$files1 = file('Anagrafica_Articoli.txt'); // read file1.txt | |
$files2 = file('Livello1.txt', FILE_IGNORE_NEW_LINES); // read file2.txt | |
// Assuming both files have equal amount of rows. | |
for($x = 0; $x < count($files1); $x++) { | |
$files1[$x] = str_replace(array("\n", "\r"), "", $files1[$x]); | |
$files3[$x] = $files1[$x]."".$files2[$x]; | |
} | |
$result = implode("|\n", $files3); |
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 | |
echo '<pre>'; | |
echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL; | |
// Download file | |
file_put_contents('prodotti.zip', file_get_contents('ftp://5100_stano:trHfD,[email protected]:21/dati/Anagrafiche.zip')); | |
$zip = new ZipArchive(); | |
$res = $zip->open('prodotti.zip'); |
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
<? | |
$anagrafiche = file('Anagrafica_Articoli.txt'); // read | |
$livello1 = file('Livello1.txt', FILE_IGNORE_NEW_LINES); // read | |
$livello2 = file('Livello2.txt', FILE_IGNORE_NEW_LINES); // read | |
$livello3 = file('Livello3.txt', FILE_IGNORE_NEW_LINES); // read | |
$livello4 = file('Livello4.txt', FILE_IGNORE_NEW_LINES); // read | |
$livello5 = file('Livello5.txt', FILE_IGNORE_NEW_LINES); // read | |
// Assuming both files have equal amount of rows. | |
for($x = 0; $x < count($anagrafiche); $x++) { |