Skip to content

Instantly share code, notes, and snippets.

View BFTrick's full-sized avatar

Patrick Rauland BFTrick

View GitHub Profile
@BFTrick
BFTrick / install-wp.sh
Last active March 18, 2026 07:20
Download & Install WordPress via Curl
curl -O https://wordpress.org/latest.zip
unzip latest.zip
mv wordpress site
rm latest.zip
@BFTrick
BFTrick / woocommerce-remove-virtual-billing-fields.php
Last active October 16, 2025 05:29
Remove the billing address fields for free virtual orders in WooCommerce
<?php
/**
* Plugin Name: WooCommerce Remove Billing Fields for Free Virtual Products
* Plugin URI: https://gist.github.com/BFTrick/7873168
* Description: Remove the billing address fields for free virtual orders
* Author: Patrick Rauland
* Author URI: http://patrickrauland.com/
* Version: 2.0
*
* This program is free software: you can redistribute it and/or modify
@BFTrick
BFTrick / .htaccess
Created September 12, 2012 13:39
Default WordPress .htaccess File
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
<?php
/**
* Plugin Name: WooCommerce API Key Warning
* Description: Warns administrators about WooCommerce API keys before user deletion
* Version: 1.0.0
* Author: Patrick Rauland
* Requires PHP: 8.2
* Requires Plugins: woocommerce
*
* @package WooCommerce_API_Key_Warning
@BFTrick
BFTrick / woocommerce-accessible-sale-price.php
Last active November 15, 2024 15:52
Make WooCommerce Sale Prices Accessible
<?php
/*
Plugin Name: WooCommerce Make Sale Prices Accessible
Plugin URI: https://gist.github.com/BFTrick/47b0710a6d27332d0c109cfe75c58be6
Description: Make WooCommerce sale prices accessible
Version: 1.0
Author: Patrick Rauland
Author URI: http://speakinginbytes.com
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@BFTrick
BFTrick / woocommerce-force-sell-only-one-product.php
Last active November 15, 2024 15:52
If you want to use WooCommerce Force Sells to add only one of the force sold products to the cart.
// only add one force sell product to the cart no matter how many of the original product are added
function my_wc_force_sell_add_to_cart_product( $product ){
$product['quantity'] = 1;
return $product;
}
add_filter( 'wc_force_sell_add_to_cart_product', 'my_wc_force_sell_add_to_cart_product' );
// when a synced force sell product is updated always set it to 1
function my_wc_force_sell_update_quantity( $quantity, $product ){
return 1;
@BFTrick
BFTrick / ship-hero-order-status.py
Last active October 21, 2024 16:47
Use the Ship Hero GraphQL API to get all orders & tracking numbers
#!/usr/bin/env python3
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
from gql.transport.exceptions import TransportQueryError
import json
import time
import os
bearer = "YOURBEARERTOKEN"
#!/usr/bin/env python3
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
from gql.transport.exceptions import TransportQueryError
import json
import time
import os
bearer = "YOURBEARERTOKEN"
@BFTrick
BFTrick / ship-hero-inventory.py
Last active October 18, 2024 21:56
Fetch SKU and available inventory from Ship Hero
#!/usr/bin/env python3
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
from gql.transport.exceptions import TransportQueryError
import json
import time
import os
bearer = ADDYOURTOKENHERE
@BFTrick
BFTrick / ship-hero-access-token.bash
Created October 15, 2024 18:12
Get an access token for Ship Hero's API
#!/usr/bin/env bash
curl -X POST -H "Content-Type: application/json" -d \
'{ "username": "EMAILHERE",
"password": "PWHERE"
}' \
"https://public-api.shiphero.com/auth/token"