This file contains 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 checkbox field to the checkout: INFORMATIVA PRIVACY | |
**/ | |
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field'); | |
function my_custom_checkout_field( $checkout ) { | |
$home = home_url( '/' ); |
This file contains 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
// Controllo se l'utente ha completato il corso | |
$course_id = intval( get_post_meta( $post->ID, '_lesson_course', true ) ); // Id del corso di cui fa parte la lezione | |
$user_id = get_current_user_id(); // Id Utente | |
// Check if course is completed | |
$user_course_status = Sensei_Utils::user_course_status( $course_id, $user_id ); | |
$completed_course = Sensei_Utils::user_completed_course( $user_course_status ); | |
// Success message | |
if ( $completed_course ) { ?> |
This file contains 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
/* ucc_get_calendar() :: Extends get_calendar() by including custom post types. | |
* Derived from get_calendar() code in /wp-includes/general-template.php. | |
*/ | |
function ucc_get_calendar( $post_types = '' , $initial = true , $echo = true ) { | |
global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; | |
if ( empty( $post_types ) || !is_array( $post_types ) ) { | |
$args = array( | |
'public' => true , |
This file contains 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
// This sample code will add additional recipients to a WooCommerce email order type, based on the order email address | |
// Email id's for the various email types (i.e. customer_invoice) can be found here: | |
// https://github.com/woothemes/woocommerce/blob/5e09f15c91970d8bec4ab56abbfd5d3039a02a1b/includes/emails/class-wc-email-customer-invoice.php#L30https://github.com/woothemes/woocommerce/blob/5e09f15c91970d8bec4ab56abbfd5d3039a02a1b/includes/emails/class-wc-email-customer-invoice.php#L30 | |
// Add the following to the bottom of your theme's functions.php: | |
add_filter( 'woocommerce_email_recipient_customer_invoice', 'woocommerce_email_customer_invoice_add_recipients' ); | |
function woocommerce_email_customer_invoice_add_recipients( $recipient, $order ) { | |
if ( '[email protected]' == $recipient ) { | |
$recipient .= ', [email protected]'; |
This file contains 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 another email recipient for admin New Order emails if a shippable product is ordered | |
* | |
* @param string $recipient a comma-separated string of email recipients (will turn into an array after this filter!) | |
* @param \WC_Order $order the order object for which the email is sent | |
* @return string $recipient the updated list of email recipients | |
*/ | |
function sv_conditional_email_recipient( $recipient, $order ) { | |
// Bail on WC settings pages since the order object isn't yet set yet |