Skip to content

Instantly share code, notes, and snippets.

View Luminus's full-sized avatar

Luminus Olumide Alabi Luminus

View GitHub Profile
@danielbitzer
danielbitzer / file.php
Last active May 18, 2023 15:31
AutomateWoo - Action function to change subscription next payment date
<?php
/**
* AutomateWoo action function to extend a subscription by 3 months.
*
* A note will be added to the subscription.
*
* Ensures that the dates near the end of the month are logically handled and do not shift to the start of the following month.
*
* Custom action function docs: https://automatewoo.com/docs/actions/custom-functions/
*
@madeincosmos
madeincosmos / functions.php
Created August 19, 2019 13:04
Send billing address to PayPal even when shipping is disabled
/* Send billing address to PayPal even when shipping is disabled (2278024-zen) */
add_filter( 'woocommerce_paypal_args', 'force_send_billing_address_to_paypal', 10 );
function force_send_billing_address_to_paypal ( $args ) {
$args[ 'no_shipping' ] = 0;
return $args;
}
@tatianamac
tatianamac / tatiana-mac-speaker-rider.md
Last active March 24, 2024 12:22
Tatiana Mac's Speaker Rider

Speaker Rider

by Tatiana Mac

Last updated 14 April 2021

What is a speaker rider?

As speaking comes with immense privilege, I have crafted a speaker rider to set expectations and boundaries around my engagement. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most historically excluded and marginalised communities.

Considerations

😫 I provide a lot of explanations for those of you who never had to consider these things. Most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

@jrick1229
jrick1229 / wcs_remove_cancel_button_MIN.php
Last active July 2, 2020 16:32
Hide the 'Cancel' button until the payment count reaches '12'.
<?php
function wcs_remove_cancel_button_MIN ( $actions, $subscription ) {
if ( $subscription->get_completed_payment_count() >= 12 ) {
return $actions;
}
unset( $actions['cancel'] );
return $actions;
}
add_filter( 'wcs_view_subscription_actions', 'wcs_remove_cancel_button_MIN', 100, 2 );
@madeincosmos
madeincosmos / functions.php
Created May 23, 2019 10:11
Add customer username and ID to WooCommerce emails
add_filter( 'woocommerce_email_customer_details_fields', 'add_user_id_to_woocommerce_emails', 10, 3);
function add_user_id_to_woocommerce_emails( $fields, $sent_to_admin, $order ) {
$user_id = $order->get_customer_id();
$user_info = get_userdata( $user_id );
$fields['user_id'] = array(
'label' => __( 'User ID', 'woocommerce' ),
'value' => $user_id
);
@Juul
Juul / amazon_fire_2015_7_inc_lineageos_install.md
Last active June 23, 2024 17:51
How to install install LineageOS on a 2015 7" Amazon Fire tablet

This is a guide for getting LineageOS (an older and unofficial version) onto an Amazon Fire 2015 7" tablet (also known as the 5th generation 7" Amazon Fire or under the internal codename "ford").

NOTE: This guide was originally written before someone figured out how to unlock the bootloader. There is now a newer method. Here it is very briefly. The old guide can be found below.

Unlocked bootloader method

First unlock the bootloader using this guide.

Once you're booted into TWRP download the latest LineageOS 14 release for your device here.

@WillBrubaker
WillBrubaker / file.php
Created March 15, 2018 13:54
WooCommerce Bookings: Remove all available blocks for the day if one is booked
//Don't know what to do with this? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'wc_bookings_product_get_available_blocks', 'beardedguy_maybe_remove_availability', 10, 5 );
function beardedguy_maybe_remove_availability( $available_blocks, $booking_object, $blocks, $intervals, $resource_id ) {
return ( sizeof( $available_blocks ) < sizeof( $blocks ) ) ? array() : $available_blocks;
}
@jessepearson
jessepearson / rewrite-wc-bookings-get-time-slots-html.php
Last active August 7, 2023 14:48
Make it so that all time slots in a time-based booking in WooCommerce Bookings shows how many spots remain, not just partially booked blocks.
<?php // do not copy this line
function rewrite_wc_bookings_get_time_slots_html( $block_html, $available_blocks, $blocks ) {
$block_html = '';
foreach ( $available_blocks as $block => $quantity ) {
if ( $quantity['available'] > 0 ) {
$block_html .= '<li class="block" data-block="' . esc_attr( date( 'Hi', $block ) ) . '"><a href="#" data-value="' . date( 'c', $block ) . '">' . date_i18n( get_option( 'time_format' ), $block ) . ' <small class="booking-spaces-left">(' . sprintf( _n( '%d left', '%d left', $quantity['available'], 'woocommerce-bookings' ), absint( $quantity['available'] ) ) . ')</small></a></li>';
}
@rynaldos-zz
rynaldos-zz / wc-sort-checkout-countries-custom.php
Last active July 2, 2020 05:27
[WooCommerce 3.0+] Custom sorting for checkout page country dropdown
// disable woocommerce sorting
add_filter( 'woocommerce_sort_countries', '__return_false' );
add_filter( 'woocommerce_countries', 'wc_custom_countries_order', 10, 1 );
function wc_custom_countries_order( $countries ) {
// replace with iso code of the country (example: US or GB)
unset($countries['country_1_iso_code']);
unset($countries['country_2_iso_code']);
unset($countries['country_3_iso_code']);
// replace with iso code of country AND country name (example: US | United States or GB | United Kingdom (UK)
@madeincosmos
madeincosmos / functions.php
Created December 1, 2017 09:51
Automatically approve registered vendors
function automaticallyApproveRegisteredVendors ( $vendorData ) {
$vendorData['role'] = 'wc_product_vendors_admin_vendor';
return $vendorData;
}
add_filter( 'wcpv_registration_default_user_data', 'automaticallyApproveRegisteredVendors', 10, 1);