Skip to content

Instantly share code, notes, and snippets.

View thomasfromwood's full-sized avatar

Thomas thomasfromwood

View GitHub Profile
@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Created August 13, 2020 20:28
Change WooCommerce Coupon amount on the fly (programmatically)
<?php
add_filter('woocommerce_get_shop_coupon_data', 'fix_wc_coupon_discount_amount', 10, 3);
function fix_wc_coupon_discount_amount( $false, $data, $coupon ) {
if (
'yes' !== get_option( 'wcj_multicurrency_compatibility_wc_coupons', 'no' )
|| is_admin()
|| empty( $coupon_id = wc_get_coupon_id_by_code( $data ) )
|| 'fixed_cart' != get_post_meta( $coupon_id, 'discount_type', true )
) {
return $false;
@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@ankurk91
ankurk91 / .htaccess
Last active January 17, 2024 18:45
Some apache .htaccess tips and tricks
# Source internet
# Use at your own risk, test on localhost first
# Ovrride Default index.php
DirectoryIndex home.php
# Prevent access to some files
<FilesMatch "^(wp-config.php|readme.html|license.txt|README.md|.gitignore|.gitattributes|.htaccess|error_log)">
Order allow,deny
Deny from all
@bitflower
bitflower / dl-file.php
Last active October 18, 2023 18:00 — forked from hakre/dl-file.php
File protection depending on ACF (Advanced custom fields) field.
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+