Skip to content

Instantly share code, notes, and snippets.

View Niloys7's full-sized avatar
🏠
Working from home

Niloy Niloys7

🏠
Working from home
View GitHub Profile
@Niloys7
Niloys7 / preorder_avaiable_date_text.php
Last active January 3, 2023 16:56
Filter for preorder available date text on single product page
add_filter('preorder_avaiable_date_text',function($text , $id){
$custom_date_format = date( 'D M d, Y', strtotime( get_post_meta($id, '_pre_order_date', true)) );
return '<span class="preorder-avaiable-date-text">Available on '.$custom_date_format.'</span>';
},10,2);
@Niloys7
Niloys7 / hide_x_button.php
Created February 10, 2022 21:16
Hide Remove Button [x] from Specific product from WooCommerce Cart
add_filter( 'woocommerce_cart_item_remove_link', 'ns_cart_item_remove_link', 20, 2 );
/**
* @snippet Hide Remove Button [x] from Specific product from WooCommerce Cart
* @author Niloy , iamniloy.com
* @param $button_link
* @param $cart_item_key
* @return mixed
*/
function ns_cart_item_remove_link( $button_link, $cart_item_key ) {
//SET HERE your specific products IDs
@Niloys7
Niloys7 / change_order_status_on_preorder_date.php
Created July 12, 2022 00:13 — forked from niloyBrightVessel/change_order_status_on_preorder_date.php
Change Preorder status after preoder date arrived
add_filter('change_order_status_on_preorder_date','bp_change_order_status',20,1);
function bp_change_order_status($status){
return 'processing';
}
@Niloys7
Niloys7 / order_email_template.php
Created February 13, 2023 12:05
Add Content in custom status email template
/**
* How to edit or override the email templates for custom order status?
* @link https://brightplugins.com/docs/how-to-edit-or-override-the-email-templates-for-custom-order-status/
*/
add_action( 'woocommerce_email_before_order_table', 'brightplugins_add_content_specific_email', 20, 4 );
function brightplugins_add_content_specific_email( $order, $sent_to_admin, $plain_text, $email ) {
if ( $email->id == 'bvos_custom_transit' ) {
echo '<p>Content for Transit Status</p>';
@Niloys7
Niloys7 / functions.php
Created August 6, 2023 14:39
Order status manager email template Customize by 3rd party plugin
/**
* https://brightplugins.com/docs/how-to-edit-or-override-the-email-templates-for-custom-order-status/
*/
add_filter( 'viwec_accept_email_type', function ($email_types) {
$email_types[] = 'bvos_custom_pickup-point'; // replace it
return $email_types;
}, 9999 );
function register_email_type( $emails ) {