Skip to content

Instantly share code, notes, and snippets.

View seb86's full-sized avatar
🚀

Sébastien Dumont seb86

🚀
View GitHub Profile
@Acephalia
Acephalia / wcdquss.php
Created March 25, 2024 20:58
Woocommerce Dequeue Unused Styles & Scripts
add_action( 'template_redirect', 'remove_woocommerce_styles_scripts', 999 );
function remove_woocommerce_styles_scripts() {
if ( function_exists( 'is_woocommerce' ) ) {
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
remove_action('wp_enqueue_scripts', [WC_Frontend_Scripts::class, 'load_scripts']);
remove_action('wp_print_scripts', [WC_Frontend_Scripts::class, 'localize_printed_scripts'], 5);
remove_action('wp_print_footer_scripts', [WC_Frontend_Scripts::class, 'localize_printed_scripts'], 5);
}
}
@woogists
woogists / woocommerce-subscriptions-download-access-after-cancelled.php
Last active June 28, 2023 02:45
[WooCommerce Subscriptions]: Give access to downloadable files even if Subscription is cancelled
<?php
/*
* Access to downloadable files associated with a subscription will, by default, expire
* when the subscription is no longer "active" or "pending-cancel".
* https://woocommerce.com/document/subscriptions/faq/#section-39
* This snippet overrides that behavior to allow access as per the Download Expiry settng
* when the subscription status is "cancelled"
*/
@DeveloperWil
DeveloperWil / woocommerce-stripe-product-customer-metadata
Created March 30, 2021 22:36
WooCommerce: Stripe product and customer metadata
/**
* Add Stripe metadata along with WooCommerce purchase
*
* @param $metadata
* @param $order
* @param $source
* @return mixed
*/
function wbdc_filter_wc_stripe_payment_metadata( $metadata, $order, $source ) {
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
@jessepearson
jessepearson / functions.php
Last active October 12, 2022 05:59
Disables opening Terms and Conditions on WooCommerce Checkout page in an inline form and instead open in a new tab or window.
<?php // do not copy this line
/**
* Disables opening the Terms and Conditions page in an inline form on the Checkout page.
* The Terms and Conditions link will then open in a new tab/window.
*/
add_action( 'wp', function() {
remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_checkout_privacy_policy_text', 20 );
remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 );
} );
/**
* Block Editor Settings.
* Add custom colors and gradients to the editor.
*/
function tabor_add_colors_and_gradients() {
$colors = array(
'primary' => '#db1c7d',
'secondary' => '#a528f0',
'tertiary' => '#90cbff',
@seb86
seb86 / wcs-contract-subscription.php
Last active April 25, 2020 11:38
Disables certain action buttons for weekly subscriptions and subscriptions with a free trial. Weekly subscriptions can not be cancelled for at least a year.
<?php
/*
* Plugin Name: WooCommerce Subscriptions - Contract Subscriptions
* Description: Disables certain action buttons for weekly subscriptions and subscriptions with a free trial. Weekly subscriptions can not be cancelled for at least a year.
* Author: Sébastien Dumont
* Author URI: https://sebastiendumont.com
* Version: 0.0.2
*
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
# Install and activate typical plugins.
plugins:
wp plugin delete hello akismet; \
wp plugin install debug-bar disable-emojis jetpack query-monitor woocommerce --activate; \
# Install, copy and clean up drop-ins.
cache-plugins:
wp plugin install batcache memcached-redux; \
cp wp-content/plugins/batcache/advanced-cache.php wp-content/advanced-cache.php; \
cp wp-content/plugins/memcached-redux/object-cache.php wp-content/object-cache.php; \
@hasparus
hasparus / README.md
Last active February 22, 2024 21:18
A color scheme for Windows Terminal

👨‍🎤 Cyberpunk SCARLET for Windows Terminal

screenshot of terminal presenting colors and borg cowsay saying "Hello!"

profile settings in screenshot

  "colorScheme": "Cyberpunk SCARLET",
  "cursorHeight": 25,
 "cursorShape": "vintage",
@jamesperrin
jamesperrin / github-labels-import.js
Last active July 17, 2023 21:10
JavaScript file for importing GitHub labels from a JSON object.
/*
Purpose: Import settings for GitHub Labels.
(c) James Perrin, MIT License, https://www.countrydawgg.com, | @jamesperrin
Importing Instructions:
1. Update the labels JSON object.
2. Open a web browser.
3. Navigate to the desired GitHub repository.