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
<? | |
/* | |
* Visit count into product page and into custom column inside admin product page called "Views" (visite) - Woocommerce | |
*/ | |
add_action('wp', function() { | |
global $post; |
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 purchase and add to cart specific product with checkbox into inventory setting product admin page and replace with required inquiry (Richiedi un preventivo) contact form | |
*/ | |
// Add checkbox | |
function action_woocommerce_product_options_inventory_product_data() { | |
// Checkbox | |
woocommerce_wp_checkbox( array( |
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 Catalog mode ( disable single product purchase ) through new stock status avaibility Woocommerce | |
*/ | |
// Add new stock status options | |
function filter_woocommerce_product_stock_status_options( $status ) { | |
// Add new statuses | |
$status['catalogo'] = __( 'Catalogo / Vetrina', 'woocommerce' ); |
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 | |
/* | |
* WooCommerce check and redirect to login before checkout | |
*/ | |
add_action('template_redirect', 'check_if_logged_in'); | |
function check_if_logged_in() | |
{ | |
$pageid = get_option('woocommerce_checkout_page_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 | |
/** | |
* Discount as fee on cart at first order exclude product on sale and if is applied a coupon disable fee - Version Update | |
*/ | |
add_action('woocommerce_cart_calculate_fees' , 'custom_discount', 10, 1); | |
function custom_discount( $cart ){ | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) || ! is_user_logged_in() ) |
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
<? | |
/* | |
* Save custom post meta into attributes and set by default multiple attribute term into the product - Woocommerce | |
*/ | |
function update_post_meta_subito($product_id) | |
{ | |
$taxonomy = 'pa_brand'; // The taxonomy |
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 | |
require ('functions/???.php'); |
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 | |
/* | |
* Save custom post meta into attribute and set by default attribute term into the product - Woocommerce | |
*/ | |
function danea_produttore_meta($product_id) | |
{ | |
// Verifica se l'ordine è in fase di elaborazione | |
if (is_checkout() && !is_wc_endpoint_url('order-received')) { |
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
<? | |
/* | |
* Convert "Draft" post to "Publish" after save post | |
*/ | |
add_action( 'save_post', 'change_post_status', 20, 2 ); | |
function change_post_status( $post_id ){ | |
$my_post = array( | |
'ID' => $post_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 Hide the Company Name Field from the Checkout Page | |
*/ | |
add_filter( 'woocommerce_checkout_fields' , 'remove_company_name' ); |