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 / gist:4fb6952f9d9f550aec9c32ecb8f70194
Created February 29, 2020 10:37 — forked from amdrew/gist:40fcef36a7842d80f66c
EDD 2.0 - Show discount field by default
<?php
/**
* Unhook default EDD discount field
*/
remove_action( 'edd_checkout_form_top', 'edd_discount_field', -1 );
/**
* Add our own callback for the discount field, keeping the same CSS as before
*/
@kish2011
kish2011 / remove_wc_data.sql
Created February 27, 2020 16:26 — forked from growdev/remove_wc_data.sql
Remove WooCommerce orders, subscriptions, non admin users
# GET number of orders
select count(*)from wp_posts where post_type = 'shop_order';
# DELETE ORDERS
delete from wp_postmeta where post_id in (
select ID from wp_posts where post_type = 'shop_order');
delete from wp_posts where post_type = 'shop_order';
# DELETE order refunds
@kish2011
kish2011 / remove_wc_data.sql
Created February 27, 2020 16:26 — forked from growdev/remove_wc_data.sql
Remove WooCommerce orders, subscriptions, non admin users
# GET number of orders
select count(*)from wp_posts where post_type = 'shop_order';
# DELETE ORDERS
delete from wp_postmeta where post_id in (
select ID from wp_posts where post_type = 'shop_order');
delete from wp_posts where post_type = 'shop_order';
# DELETE order refunds
@kish2011
kish2011 / wp-frm-populate-user-dropdown.php
Last active November 16, 2019 10:46
Add user dropdown in formidableforms
// call it in your theme or plugin function file.
wp_frm_populate_user_dropdown( 485, 'subscriber' ); // you can change field_id & role as per your need.
function wp_frm_populate_user_dropdown($field_id, $role = 'subscriber') {
$user_info = array ( 'field_id' => $field_id, 'role' => $role );
add_filter('frm_setup_new_fields_vars', function ( $values, $field ) use ($user_info) {
$values = frm_populate_user_dropdown($values, $field, $user_info);
return $values;
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/forge/app.com/artisan queue:work sqs --sleep=3 --tries=3
autostart=true
autorestart=true
user=forge
numprocs=8
redirect_stderr=true
stdout_logfile=/home/forge/app.com/worker.log
@kish2011
kish2011 / receive.php
Created September 23, 2019 17:01
Receiving data from RabbitMQ queue.
<?php
require_once __DIR__ . '/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();
$channel->queue_declare('hello', false, false, false, false);
@kish2011
kish2011 / send.php
Last active September 23, 2019 17:00
Sending message to RabbitMQ
<?php
require_once __DIR__ . '/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();
$channel->queue_declare('hello', false, false, false, false);
@kish2011
kish2011 / adding_new_webhook_topics.php
Created August 27, 2019 18:06 — forked from jessepearson/adding_new_webhook_topics.php
How to add a new custom Webhook topic in WooCommerce, with example of order filtering.
<?php // do not copy this line
/**
* add_new_topic_hooks will add a new webhook topic hook.
* @param array $topic_hooks Esxisting topic hooks.
*/
function add_new_topic_hooks( $topic_hooks ) {
// Array that has the topic as resource.event with arrays of actions that call that topic.
@kish2011
kish2011 / add-to-cart.php
Created August 16, 2019 11:20 — forked from lukecav/add-to-cart.php
Display Product Variations in the Shop Loop - With Conditional Apply Filter Logic
<?php
/**
* Custom Loop Add to Cart.
*
* Template with quantity and ajax.
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
global $product;
@kish2011
kish2011 / wc-hide-coupons-cart-checkout.php
Created August 16, 2019 08:45 — forked from maxrice/wc-hide-coupons-cart-checkout.php
WooCommerce - hide the coupon form on the cart or checkout page, but leave coupons enabled for use with plugins like Smart Coupons and URL Coupons
<?php
// hide coupon field on cart page
function hide_coupon_field_on_cart( $enabled ) {
if ( is_cart() ) {
$enabled = false;
}
return $enabled;