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_filter('preorder_avaiable_date_text_cart','bp_override_preorder_cart_notice',10,2); | |
function bp_override_preorder_cart_notice($notice,$diff){ | |
$notice = '<br/><small style="color:green"> '.sprintf(__("Note: this item will be available for shipping in %s days</small>",'preorders'),$diff).'</small>'; | |
return $notice; | |
} |
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_filter('preorder_avaiable_date_text', 'bpCustomMessage',10); | |
add_filter('preorder_avaiable_date_text_loop', 'bpCustomMessage',10); | |
add_filter('preorder_avaiable_date_text_cart', 'bpCustomMessage',10); | |
function bpCustomMessage($text){ | |
$data = $text; | |
return '<div class="preorder-date-wrapper">'.$data.'</div>'; |
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_filter('woocommerce_cart_item_name', 'bpPreorderDateInCheckoutItems',10,3); | |
// Display a preorder date under cart item name in checkout | |
function bpPreorderDateInCheckoutItems($p_name,$cart_item, $cart_item_key) | |
{ | |
// Here below define your shipping class slug | |
$isPreoder = get_post_meta($cart_item['product_id'], '_is_pre_order', true); | |
$PreOrderDate = get_post_meta($cart_item['product_id'], '_pre_order_date', true); | |
if ('yes' == $isPreoder && strtotime($PreOrderDate) > time()) { | |
$timeFormat = date_i18n(get_option('date_format'), strtotime($PreOrderDate)) ; |
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_filter('change_order_status_on_preorder_date','bp_change_order_status',20,1); | |
function bp_change_order_status($status){ | |
return 'processing'; | |
} |
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
/* | |
* List WooCommerce Products by attributes | |
* | |
* ex: [woo_products_by_attributes attribute="colour" per_page="5"] | |
*/ | |
function woo_products_by_attributes_shortcode( $atts, $content = null ) { | |
global $woocommerce, $woocommerce_loop; |