Skip to content

Instantly share code, notes, and snippets.

View kloon's full-sized avatar

Gerhard Potgieter kloon

View GitHub Profile
@kloon
kloon / functions.php
Created October 9, 2017 12:25
WooCommerce hide refund reason from customer
<?php
/**
* Replace refund reason with generic Refund text.
*
* @param $total_rows
* @param $order
* @param $tax_display
* @return array
*/
function remove_public_facing_refund_reason( $total_rows, $order, $tax_display ) {
@kloon
kloon / functions.php
Last active October 27, 2021 04:47
WooCommerce 3.2: Add resend admin order email option that was removed
<?php
/**
* This adds back an option to resend the admin new order email from the order edit screen that was removed in WooCommerce 3.2
*/
/**
* Filter to add a new menu to the dropdown
*
* @param array $actions
* @return array
@kloon
kloon / btc-eth-luno-buy.php
Last active July 23, 2022 12:37
Luno.com "Dollar Cost Avg" daily buy script for BTC & ETH
<?php
/**
* Buy BTC & ETH daily on Luno.com
* @author Gerhard Potgieter <[email protected]>
* @since 2017-12-07
* https://www.luno.com/invite/JN5Z4
*
* This script will do a daily purchase of BTC and ETH on Luno.com based on rand value (ZAR) set. Default to R100 each. Why daily? https://en.wikipedia.org/wiki/Dollar_cost_averaging
*
* Installation Instructions
@kloon
kloon / woocommerce-3.3-hide-uncetagorized-category.php
Created February 9, 2018 05:30
WooCommerce 3.3 Hide uncategorized category from shop
<?php
add_filter( 'woocommerce_product_subcategories_args', 'remove_uncategorized_category' );
/**
* Remove uncategorized category from shop page.
*
* @param array $args Current arguments.
* @return array
**/
function remove_uncategorized_category( $args ) {
$uncategorized = get_option( 'default_product_cat' );
@kloon
kloon / woocommerce-api-products-response-image-sizes.php
Last active May 2, 2018 05:35
WooCommerce API: Add different image sizes and urls to response
<?php // Do not include this line when adding the code to an existing file.
add_filter( 'woocommerce_rest_prepare_product_object', 'wc_api_add_image_sizes_products_response', 10, 3 );
/**
* Add different product image sizes and URLs to the product images response.
*
* @param Object $response The response object.
* @param $post
* @param $request