Skip to content

Instantly share code, notes, and snippets.

View ChaseWiseman's full-sized avatar

Chase Wiseman ChaseWiseman

View GitHub Profile
<?php
interface SettingsInterface {
public function get_setting( $key );
public function set_setting( $key, $value );
<?php // only include this if needed
add_filter( 'wc_google_analytics_pro_script_attributes', function( $attributes ) {
$attributes['data-wpfc-render'] = 'false';
return $attributes;
} );
<?php
/**
* Plugin Name: SkyVerge WordPress Plugin Admin Tester
* Plugin URI: #
* Description: Test the SkyVerge WordPress Plugin Admin
* Author: SkyVerge
* Author URI: https://skyverge.com
* Version: 1.0.0
*/
@ChaseWiseman
ChaseWiseman / wc-elavon-log-avs-results.php
Created July 3, 2020 01:24
Adds an order note with the returned AVS results for Elavon Credit Card transactions
<?php // only include this if needed
add_action( 'wc_payment_gateway_elavon_converge_credit_card_add_transaction_data', function( $order, $response ) {
if ( $order instanceof \WC_Order && $response instanceof \WC_Elavon_Converge_API_Credit_Card_Transaction_Response ) {
$message = sprintf(
'Elavon Fraud Results:<br />AVS Result: %s<br />CSC Result: %s',
esc_html( $response->get_avs_result() ),
esc_html( $response->get_csc_result() )
<?php // only copy this if needed!
add_filter( 'wc_memberships_my_account_redirect_to_single_membership', '__return_false' );
@ChaseWiseman
ChaseWiseman / wc-authorize-net-decode-extra-options.php
Created June 10, 2020 23:44
Decode extra options when processing profile requests
<?php // only include this if needed
add_filter( 'wc_authorize_net_cim_api_request_data', function( $data ) {
if ( ! empty( $data['createCustomerProfileTransactionRequest']['extraOptions'] ) ) {
$data['createCustomerProfileTransactionRequest']['extraOptions'] = urldecode( $data['createCustomerProfileTransactionRequest']['extraOptions'] );
}
return $data;
@ChaseWiseman
ChaseWiseman / sv-wc-pip-add-order-delivery-details.php
Created April 30, 2020 02:36
Add a time frame to PIP invoices
<?php // only copy this line if needed
/**
* Adds Order Delivery date to the "Shipping Method" section of invoices and packing lists
* 'Show shipping method' should be enabled for invoices!
*
* @param string $shipping the shipping method text
* @param string $document_type the type of document being viewed
* @param \WC_Order $order the order object the document is for
* @return string the updated shipping string
*/
@ChaseWiseman
ChaseWiseman / woocommerce-twilio-sms-send-customer-notes.php
Last active April 21, 2020 01:20
Send SMS notifications to customers when a customer-facing note is added to an order
<?php // only include this if needed
/**
* Sends an SMS to the customer whenever a new customer note is added to an order.
*
* Customer notes usually trigger an email if enabled.
*/
add_action( 'woocommerce_new_customer_note', function( $args ) {
if ( ! class_exists( 'WC_Twilio_SMS_Notification' ) || empty( $args['order_id'] ) || empty( $args['customer_note'] ) ) {
@ChaseWiseman
ChaseWiseman / disable-jilt-for-edd-js.php
Created February 25, 2020 18:33
Limit Jilt for EDD JS to logged-in users
<?php // only copy this line if needed
add_action( 'wp_enqueue_scripts', function() {
if ( ! is_user_logged_in() ) {
wp_dequeue_script( 'edd-jilt' );
}
}, 15 );
@ChaseWiseman
ChaseWiseman / plugin.php
Created August 3, 2018 23:41
WC Settings API Refactor
<?php
class WooCommerce {
public $settings;
public function init() {
// all that other fun init stuff