Skip to content

Instantly share code, notes, and snippets.

View mirite's full-sized avatar

Jesse Conner mirite

View GitHub Profile
@mirite
mirite / index.php
Created April 10, 2022 14:13
Have a product in WooCommerce take its inventory from another product
<?php
/**
* Variations Pull From Product Inventory
*
* @wordpress-plugin
* Plugin Name: Variations Pull From Product Inventory
* Description: A WooCommerce plugin to allow variations to pull from another product's inventory.
* Version: 1.3.0
* Requires at least: 5.2
* Requires PHP: 7.2
@mirite
mirite / index.php
Created April 10, 2022 00:28
Restrict product visibility in WooCommerce to a specific user role
<?php
/**
* Limit Product Visibility
* @wordpress-plugin
* Plugin Name: Limit Product Visibility
* Description: A WooCommerce plugin to limit product visibility to administrators and a user role called Reps.
* Version: 1.0.0
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: Jesse Conner
@mirite
mirite / example.js
Created November 24, 2020 18:42
Capture values of all check boxes in a form
var boxes = jQuery(this).find(':checkbox').toArray();
var values = {};
boxes.forEach(t => {
values[t.id] = t.checked;
});
@mirite
mirite / wait in node
Created November 11, 2020 16:19
Wait for set amount of time in NodeJS
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
//Wait for one second.
await sleep(1000);
@mirite
mirite / functions.php
Last active November 5, 2020 15:26
Always show recurring shipping options for WooCommerce Subscriptions
//This filter is called when creating the recurring shipping text for a WooCommerce subscription
add_filter("wcs_cart_totals_shipping_html_price_only", "rt_always_show_shipping");
function rt_always_show_shipping(){
return false;
}