Skip to content

Instantly share code, notes, and snippets.

View seb86's full-sized avatar
🚀

Sébastien Dumont seb86

🚀
View GitHub Profile
<?php
/**
* I hired a translator to translate my plugin into Spanish (Mexico). I want to
* create variants for the 13 other Spanish locales on translate.wordpress.org.
*/
$es_mx_file_paths = array(
'wp-plugins-inventory-presser-stable-es-mx.po',
'wp-plugins-inventory-presser-stable-readme-es-mx.po',
);
@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 December 2, 2024 18:16
[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"
*/
@csalzano
csalzano / password-protection-admin-bypass.php
Created June 23, 2022 02:27
WordPress plugin. Allows logged-in administrators to bypass password protection on pages and posts.
<?php
defined( 'ABSPATH' ) or exit;
/**
* Plugin Name: Password Protection Admin Bypass
* Description: Allows logged-in administrators to bypass password protection on pages and posts.
* Version: 1.0.0
* Author: Corey Salzano
* Author URI: https://github.com/csalzano
* Plugin URI: https://gist.github.com/csalzano/f10727dfff7614decbe663912d9c86d9
@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; \