Skip to content

Instantly share code, notes, and snippets.

View billrobbins's full-sized avatar

Bill Robbins billrobbins

View GitHub Profile
<?php
add_filter( 'woocommerce_states', 'ijab_add_puerto_rico_wc_states' );
function ijab_add_puerto_rico_wc_states( $states ) {
$states['US'] = array(
'AL' => __( 'Alabama', 'woocommerce' ),
'AK' => __( 'Alaska', 'woocommerce' ),
'AZ' => __( 'Arizona', 'woocommerce' ),
'AR' => __( 'Arkansas', 'woocommerce' ),
// This function disables the Stripe gateway everywhere except for the order-pay endpoint.
// It also removes the Check gateway from the order-pay endpoint.
function ijab_selected_gateways_order_pay( $available_gateways ) {
if ( is_checkout() && ! is_wc_endpoint_url( 'order-pay' ) ) {
unset( $available_gateways[ 'stripe' ] );
}
if ( is_checkout() && is_wc_endpoint_url( 'order-pay' ) ) {
add_filter( 'woocommerce_gateway_payfast_is_valid_ip', '__return_true' );
<?php
/**
* The custom css generator.
*
* This file takes the custom styling from
* the theme options page and adds it to the
* header.php file.
*
* @package Live
* @since 3.0.0
function woohe_forcelogin_bypass( $bypass ) {
if ( is_wc_endpoint_url( 'lost-password' ) ) {
$bypass = true;
}
return $bypass;
}
add_filter( 'v_forcelogin_bypass', 'woohe_forcelogin_bypass' );
<?php $ih_sc = $product->get_shipping_class(); ?>
<?php /* <?php if($ih_sc === 'level-iv') : ?>
<p style="color: #666666;"><small><i>*Delivery Surcharge: $150</i></small></p>
<?php elseif($ih_sc === 'level-v') : ?>
<p style="color: #666666;"><small><i>*Delivery Surcharge: $150</i></small></p> */ ?>
<?php if($ih_sc === 'level-vi') : ?>
<p style="color: #666666;"><small><i>*Delivery Surcharge: $150</i></small></p>
<?php elseif($ih_sc === 'level-vii') : ?>
<p style="color: #666666;"><small><i>*Delivery Surcharge: $150</i></small></p>
<p style="margin:0 0 16px;color:#505050;font-size:12px"><br><img src="https://weinbergstage.wpengine.com?data=b2lkPTMmZWlkPTY1MTEmdXNlcl9lbWFpbD1hZGFtQHRpbWVsaW5ldmlkZW8uY29tJnVzZXJfaWQ9Mg%3D&amp;fuepx=1" height="1" width="1" style="border:none;display:inline-block;font-size:14px;font-weight:bold;height:auto;outline:none;text-decoration:none;text-transform:capitalize;vertical-align:middle;margin-right:10px"></p>
/**
* An easy way to delete all unsent items in the queue.
*/
public static function process_queue_delete_all() {
if ( empty( $_REQUEST['fue_delete_all'] ) ) {
return;
}
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'bulk-items' ) ) {
wp_die( __( 'Are you sure you want to do this?', 'follow_up_emails' ) );
@billrobbins
billrobbins / gettext_minmax_quantities.php
Last active January 14, 2019 20:25
Place the original text on the left of the => and the new text on the right.
function change_deposit_text( $translated ) {
$text = array(
'The minimum order quantity for %s is %s - please increase the quantity in your cart.' => 'Ahh man, For %s you need a total of %s to order',
);
$translated = str_ireplace( array_keys($text), $text, $translated );
return $translated;
}
add_filter( 'gettext', 'change_deposit_text', 20 );
<?php single_post_title(); ?>