Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
damiencarbery / flash-animation.css
Last active December 10, 2021 14:03
Edit stock levels in WooCommerce - Add editing capability to the List stock levels in WooCommerce plugin - https://www.damiencarbery.com/2019/10/edit-stock-levels-in-woocommerce
table.wp-list-table tr.updated { animation: highlight 3s ease 2; }
@keyframes highlight {
0% { background-color: inherit; }
50% { background-color: #d1fa88; }
100% { background-color: inherit; }
}
@carasmo
carasmo / dequeue-woocommerce-js-css-on-non-woo-pages.php
Last active July 21, 2024 19:27
Dequeue WooCommerce CSS and JS on non-WooCommerce pages for 3.6.4
<?php
//don't add above twice if it already exists
/**
* Check if WooCommerce Page of all kinds (not just cart and shop)
* @thanks: https://faish.al/2014/01/06/check-if-it-is-woocommerce-page/
* Checked IDS with WooCommerce Repo 1 June 2019
*/
function ca_is_really_woocommerce_page() {
@froger-me
froger-me / wp-specific-auto-updates.php
Last active November 19, 2021 10:19
WordPress auto updates for specific plugins and themes
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
function auto_update_specific_plugins( $update, $item ) {
// Array of plugin slugs to always auto-update
$plugins = array(
'dummy-plugin',
@em-piguet
em-piguet / woocommerce_script_cleaner.php
Last active October 28, 2019 18:07
Manage WooCommerce styles and scripts
<?php
////////////////////////////////////////////
// Manage WooCommerce styles and scripts. //
////////////////////////////////////////////
function woocommerce_script_cleaner() {
// Remove the generator tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
// remove definitly, no need of this one
///////////////////////////////////////////////////
@orvigas
orvigas / arraySum.php
Created January 31, 2018 21:47
Function to sum two arrays in php
<?php
/**
* Function to sum two arrays
*
* @param array $a First array to merge
* @param array $b Second array to merge which gonna be returned by function
*
* @author Orlando Villegas Galán <orvigas@gmail.com>
* @return $b
*/
@kloon
kloon / functions.php
Last active October 27, 2021 04:47
WooCommerce 3.2: Add resend admin order email option that was removed
<?php
/**
* This adds back an option to resend the admin new order email from the order edit screen that was removed in WooCommerce 3.2
*/
/**
* Filter to add a new menu to the dropdown
*
* @param array $actions
* @return array
<?php
/*
This script will allow you to send a custom email from anywhere within wordpress
but using the woocommerce template so that your emails look the same.
Created by craig@123marbella.com on 27th of July 2017
Put the script below into a function or anywhere you want to send a custom email
*/
@simivar
simivar / print_r_reverse.php
Last active November 4, 2023 23:27
PHP function to reverse print_r function
<?php
/**
* I've published a fully-tested Composer library with type-casting.
* @see https://github.com/simivar/reverse-print-r
*/
/**
* Matt: core
* Trixor: object handling
* lech: Windows suppport
@prikhi
prikhi / wc-custom-purchased-column.php
Last active June 15, 2020 06:24 — forked from rynaldos-zz/wc-custom-purchased-column.php
[WooCommerce 3.0+] Re-instate the "Purchased items" column on orders page
<?php
/** Add a Purchased Column w/ Item Quantity, SKU, Name, & Meta to the Admin Orders Table **/
class ThemeWooCommerce
{
/* Add a `Purchased` Column to the Admin Orders Table */
public static function add_purchased_column_header($columns) {
$new_columns = array();
foreach ($columns as $key => $title) {
if ($key === 'billing_address') {
$new_columns['order_items'] = __('Purchased', 'woocommerce');
@rynaldos-zz
rynaldos-zz / wc-custom-purchased-column.php
Last active June 15, 2020 06:26
[WooCommerce 3.0+] Re-instate the "Purchased items" column on orders page
add_filter('manage_edit-shop_order_columns', 'wc_custom_purchased_column');
function wc_custom_purchased_column($columns)
{
$new_array = array();
foreach ($columns as $key => $title) {
if ($key == 'billing_address') {
$new_array['order_items'] = __('Purchased', 'woocommerce');
}