Skip to content

Instantly share code, notes, and snippets.

@komal-maru
komal-maru / disable-fix-block-at-admin-end.php
Created March 6, 2025 11:12
To disable the Fixed Block Booking on the admin end.
/**
* Disable the Fixed Block Booking on the admin end.
*/
function bkap_init_parameter_localize_script_booking_settings( $booking_settings ) {
if ( isset( $_GET['booking_post_id'] ) ) {
$booking_settings['booking_fixed_block_enable'] = '';
$booking_settings['bkap_fixed_blocks_data'] = array();
@komal-maru
komal-maru / functions.php
Last active February 13, 2025 15:36
functions.php
function enqueue_select2_scripts() {
wp_enqueue_script('select2-js', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js', array('jquery'), '4.0.13', true);
wp_enqueue_style('select2-css', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css', array(), '4.0.13');
$custom_css = "
span.select2.select2-container {
width: 100% !important;
}
";
wp_add_inline_style('select2-css', $custom_css);
wp_add_inline_script('select2-js', "
@komal-maru
komal-maru / wc-add-order-status-dashboard-status-widget
Last active March 9, 2023 05:05
Add a new WooCommerce order status into Dashboard status widget
<?php
//Add a WooCommerce order status (completed, refunded) into the Dashboard status widget
function woocommerce_add_order_status_dashboard_widget() {
if ( ! current_user_can( 'edit_shop_orders' ) ) {
return;
}
$refunded_count = 0;
$completed_count = 0;
foreach ( wc_get_order_types( 'order-count' ) as $type ) {
@komal-maru
komal-maru / wc-disable-coupon-code-on-checkout-page
Created October 1, 2018 05:37
Hide the Coupon code on the checkout page
<?php
// hide coupon field on the checkout page
function disable_coupon_field_on_checkout( $enabled ) {
if ( is_checkout() ) {
$enabled = false;
}
return $enabled;
}
add_filter( 'woocommerce_coupons_enabled', 'disable_coupon_field_on_checkout' );
@komal-maru
komal-maru / wc-disable-coupon-code-on-cart-page
Last active October 1, 2018 05:38
Hide the Coupon code on the cart page
<?php
// hide coupon field on the cart page
function disable_coupon_field_on_cart( $enabled ) {
if ( is_cart() ) {
$enabled = false;
}
return $enabled;
}
add_filter( 'woocommerce_coupons_enabled', 'disable_coupon_field_on_cart' );