Skip to content

Instantly share code, notes, and snippets.

View ChaseWiseman's full-sized avatar

Chase Wiseman ChaseWiseman

View GitHub Profile
<?php // remove if not needed
add_filter( 'wc_first_data_payeezy_credit_card_perform_pre_auth', '__return_true' );
<?php // Remove if not needed
/**
* Sets a dummy postcode if required by the CIM payment processor.
*/
function sv_wc_authorize_net_cim_set_uae_postcode( $data ) {
if ( ! empty( $data['billing_country'] ) && 'AE' === $data['billing_country'] ) {
$data['billing_postcode'] = '00000';
}
@ChaseWiseman
ChaseWiseman / subcategory-madness.php
Created September 30, 2017 02:15
Subcategory madness
<?php // remove this if you don't need it
function riz_new_subcategory_hierarchy( $path ) {
$category = get_queried_object();
$parent_id = $category->category_parent;
if ( 123456 != $parent_id ) { // Your category ID
return $path;
<?php
/**
* Sets a unique Merchant ID depending on the order currency for Bambora transaction requests.
*
* @param array $request_data transaction request data
* @param \WC_Order $order order object
* @return array
*/
function sv_wc_bambora_set_currency_merchant_id( $request_data, $order ) {
@ChaseWiseman
ChaseWiseman / phpcs.ruleset.xml
Created April 27, 2017 23:22
Sample SkyVerge WooCommerce coding standards
<?xml version="1.0"?>
<ruleset name="SkyVerge PHP Coding Standards">
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Core/ruleset.xml -->
<!-- Set a description for this ruleset. -->
<description>A custom set of code standard rules to check for WordPress themes and plugins.</description>
<!-- Include the WordPress ruleset, with exclusions. -->
<rule ref="WordPress">
@ChaseWiseman
ChaseWiseman / load-modal.js
Last active November 23, 2019 17:02
Load modals as WordPress template parts via AJAX
$( function() {
var loadModal = function( modal ) {
$.post(
pinwheel_modals.ajax_url,
{
action: 'load_modal',
modal: modal
},
@ChaseWiseman
ChaseWiseman / convert-post-meta.php
Last active December 27, 2015 09:50
A function for converting existing WordPress meta keys to new values.
/**
* Convert existing meta keys to new meta keys.
*
* @since x.x.x
*
* @global object $wpdb The current database.
*
* @param string $existing_key The existing meta key.
* @param string $new_key The new meta key.
* @param bool $remove_existing Optional. Whether to remove the old meta entries after conversion.