Skip to content

Instantly share code, notes, and snippets.

View rayflores's full-sized avatar

Ray Flores rayflores

View GitHub Profile
<?php
global $post, $product;
?>
<div class="col-lg-6 col-md-6 toppurchase textaligncenter">
<?php if ( $product->is_in_stock() ) : ?>
<?php
@rayflores
rayflores / join-search.php
Created August 6, 2014 20:30
join and search
<?php
function justin_search_join( $join ) {
global $wpdb;
if( is_search() && !is_admin()) {
$join .= "LEFT JOIN $wpdb->postmeta AS m ON ($wpdb->posts.ID = m.post_id) ";
}
return $join;
}
//add_filter('posts_join', 'justin_search_join' );
function justin_search_groupby( $groupby ) {
<?php
/**
* Shipping Methods Display - cart-shipping.php template /woocommerce/cart/cart-shipping.php
*
* In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.0
*/
@rayflores
rayflores / unset_line_items.php
Created September 5, 2014 18:22
unset_line_items for exporter
<?php
function sv_add_weight_to_csv_export_line_item( $line_item, $item, $product, $order ) {
//$line_item['weight'] = 'weight:' . $product->get_weight();
unset($line_item['name']);
return $line_item;
}
add_filter( 'wc_customer_order_csv_export_order_line_item', 'sv_add_weight_to_csv_export_line_item', 10, 4 );
<?php
/*
Plugin Name: WooCommerce Amazon Payments Advanced Gateway
Plugin URI: http://woothemes.com/woocommerce
Description: Amazon Payments Advanced is embedded directly into your existing web site, and all the buyer interactions with Amazon Payments Advanced take place in embedded widgets so that the buyer never leaves your site. Buyers can log in using their Amazon account, select a shipping address and payment method, and then confirm their order. Requires an Amazon Seller account with the Amazon Payments Advanced service provisioned. Supports DE, UK, and US.
Version: 1.2.6
Author: WooThemes
Author URI: http://woothemes.com
Copyright: © 2009-2011 WooThemes.
<?php
add_filter( 'woocommerce_available_shipping_methods', 'custom_shipping_methods' );
function custom_shipping_methods( $available_methods ) {
$carrier = 'ups';
foreach ( WC()->cart->cart_contents AS $item ) {
if ( has_term( 'large-item', 'product_shipping_class', $item['product_id'] ) ) {
$carrier = 'usps';
continue;
}
}
@rayflores
rayflores / remove-filters.php
Created September 12, 2014 06:28
Remove filters from Shipment Tracking plugin class
<?php
function remove_filters_from_shipping_class( ) {
if (class_exists('WC_Shipment_Tracking')) {
global $WC_Shipment_Tracking; //globalize class from another plugin
// filters from WC_Shipment_Tracking class - which add the tracking info into the exporter class - needed to remove entire filters
remove_filter( 'wc_customer_order_csv_export_order_headers', array( &$WC_Shipment_Tracking, 'add_tracking_info_to_csv_export_column_headers' ) );
remove_filter( 'wc_customer_order_csv_export_order_row', array( &$WC_Shipment_Tracking, 'add_tracking_info_to_csv_export_column_data' ), 10, 3 );
}
}
@rayflores
rayflores / add-notes-next-to-shipping.php
Created September 16, 2014 05:09
If you needed to add notes close to the available shipping methods
<?php
/**
* Plugin Name: WooCommerce Add Shipping Notes
* Description: Adds some shipping notes to the cart page
* Version: 1.0.0
* Author: Ray Flores
* Author URI: http://www.rayflores.com
* Requires at least: 3.9
* Tested up to: 3.9
*
<?php
/*
Plugin Name: WooCommerce FIS Gateway
Plugin URI: http://rayflores.com/plugins/fis-gateway
Description: Extends WooCommerce with a <a href="https://paydirect.ca.link2gov.com/SFACArtsSales" target="_blank">FIS</a> gateway. A FIS gateway account, and a server with SSL support and an SSL certificate is required for security reasons.
Author: Ray Flores
Author URI: http://rayflores.com
Version: 1.0.0
Text Domain: wc-gateway-fis
Domain Path: /languages/
@rayflores
rayflores / end-resulting-modified-exporter.php
Last active December 10, 2015 22:46
Need to be able to use "Default - One Row Per Item" setting but not getting "admin custom fields" and not getting concatenated shipping_firstname + shipping_last_name ---- seems to work just fine with "Default"
<?php
/**
* Plugin Name: WooCommerce Modify CSV Exported file
* Description: Adds and removes desired and undesired fields respectively
* Version: 1.0.0
* Author: Ray Flores
* Author URI: http://www.rayflores.com
* Requires at least: 3.9
* Tested up to: 3.9
*