Skip to content

Instantly share code, notes, and snippets.

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

Kishore Chandra Sahoo kish2011

🏠
Working from home
View GitHub Profile
@kish2011
kish2011 / set_deny_on_zero_stock.py
Created August 26, 2025 18:45
set_deny_on_zero_stock.py
import requests
SHOP_NAME = "store-dev"
ACCESS_TOKEN = "shpat_***1143aa466e90046d79dcbe3d*****"
API_VERSION = "2023-07"
headers = {
"X-Shopify-Access-Token": ACCESS_TOKEN,
"Content-Type": "application/json"
}
<?php
/**
* Add the field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>';
@kish2011
kish2011 / functions.php
Created May 9, 2025 18:47 — forked from bmakowski/functions.php
WooCommerce additional custom popup on checkout when processing payment
add_action( 'woocommerce_before_checkout_form', 'custom_payment_overlay' );
function custom_payment_overlay(){
echo sprintf('<div class="custom-payment-popup"><div class="wpt-payment-overlay"></div><div class="wpt-payment-message">%s</div></div>',
'We are processing your payment. Please hold on and do not refresh your browser.'
);
}
@kish2011
kish2011 / bb-custom-notice.php
Created March 11, 2025 08:52
Custom BP Notification2
<?php
/*
* Plugin Name: Custom BP Notification2
* Plugin URI: https://example.com/plugins/the-basics/
* Description: Handle the basics with this plugin.
* Version: 1.10.3
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: Sajib Talukder
<?php
/**
* Put this into your functions.php of your child-theme or custom plugin
* you can create the role with wp-cli by running `wp shell` and running the command:
* add_role('merchant','Merchant',array('read' => true, 'delete_posts' => false) );
*/
/**
* Step #1: create the field used to store the new sale_price for product_variation and for products
*/
@kish2011
kish2011 / wp-rest-api-grid-block.php
Created January 4, 2025 07:13
WP REST API Grid Block
<?php
/*
Plugin Name: WP REST API Grid Block
Description: A Gutenberg block that fetches posts via the REST API and displays them in a grid.
Version: 1.0
Author: Your Name
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
@kish2011
kish2011 / woocommerce_events.md
Created December 7, 2024 10:29 — forked from mpdevcl/woocommerce_events.md
WooCommerce JS Events

WooCommerce JS Events

Source

Checkout

$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
@kish2011
kish2011 / your-main-plugin-file.php
Created November 27, 2024 11:53 — forked from maddisondesigns/your-main-plugin-file.php
Declare HPOS compatibility in your WooCommerce plugin. Add this code to your main plugin file.
<?php
/**
* Declare WooCommerce HPOS compatibility
*/
function yourplugin_declare_hpos_compat() {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
}
}
add_action( 'before_woocommerce_init', 'yourplugin_declare_hpos_compat' );
@kish2011
kish2011 / falsehoods-programming-time-list.md
Created November 27, 2024 06:00 — forked from timvisee/falsehoods-programming-time-list.md
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@kish2011
kish2011 / custom_comments.php
Created November 20, 2024 12:14 — forked from ramseyp/custom_comments.php
Different ways of customizing the WordPress comment form
<?php
// Customized the comment form fields ( not the comment text area )
add_filter('comment_form_default_fields', 'my_comment_form_args');
// Customizes the text area - you have to do this here, rather than in comment_form_default_fields
add_filter('comment_form_field_comment', 'my_comment_form_field_comment');
// Customized the comment notes above the form fields
add_filter( 'comment_form_defaults', 'my_comment_form_defaults' );