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 ) {
@Niloys7
Niloys7 / config.php
Last active February 19, 2025 15:16
one click demo import (OCDI) is not adding elementor global options
/**
* Function to perform setup after importing data.
* This function assigns the front page and the posts page (blog page) based on the imported demo.
* @param array $selected_import The selected import data.
* @link https://www.codeixer.com/addressing-the-issue-of-one-click-demo-import-not-add-elementor-global-options/
*/
function cdx_after_import_setup( $selected_import ) {
// Import Elementor kit data.
@Niloys7
Niloys7 / functions.php
Created April 2, 2025 11:29
Show a custom checkbox before the "Place Order" button on the checkout page if the cart contains deposit items.
<?php
// Add the required checkbox right before the "Place Order" button
// plugin: https://www.codeixer.com/woocommerce-deposits-plugin/
add_action('woocommerce_review_order_before_submit', 'custom_checkout_terms_checkbox', 9);
function custom_checkout_terms_checkbox() {
if(!cidw_cart_have_deposit_item()){
return;
}
?>
<p class="form-row terms-field" style="margin-bottom: 15px;">