Skip to content

Instantly share code, notes, and snippets.

View DanielSantoro's full-sized avatar

Danny Santoro DanielSantoro

View GitHub Profile
@DanielSantoro
DanielSantoro / functions.php
Last active November 16, 2016 15:48
Modify WC Add to Cart Button - 494224
<?php
// Modify WC Add to Cart - Send to Page Instead
add_filter( 'woocommerce_loop_add_to_cart_link', 'ds_change_addtocart_destination', 100 );
function ds_change_addtocart_destination( $link ) {
global $product;
$product_id = $product->id;
$product_sku = $product->get_sku();
$link = '<a href="'.get_permalink().'" rel="nofollow" data-product_id="'.$product_id.'" data-product_sku="'.$product_sku.'" data-quantity="1" class="button add_to_cart_button product_type_variable">More Information</a>';
return $link;
@DanielSantoro
DanielSantoro / class-wc-payment-gateways.php
Created November 1, 2016 17:17
Gateway Code (starting at line 70)
/**
* Load gateways and hook in functions.
*/
public function init() {
$load_gateways = array(
'WC_Gateway_BACS',
'WC_Gateway_Cheque',
'WC_Gateway_COD',
'WC_Gateway_Paypal',
);
@DanielSantoro
DanielSantoro / functions.php
Last active October 26, 2016 18:34
Per-State Surcharge on WC Orders
function ds_per_state_fees() {
global $woocommerce;
$packages = $woocommerce->shipping->packages;
$state_fees = array(
'AK' => array( // Alaska Fee in Dollars
'amount' => 20,
'is_taxable' => false,
'name' => __( 'Handling Fee', 'woo-statefee' ),
), // End of fee
'HI' => array( // Hawaii Fee in Dollars
@DanielSantoro
DanielSantoro / functions.php
Created October 24, 2016 17:29
Sample Google Analytics Function
function custom_add_google_analytics() { ?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-XX', 'auto');
ga('send', 'pageview');
@DanielSantoro
DanielSantoro / functions.php
Created October 7, 2016 17:21
Add to Functions (Facebook Tracking Pixel)
/**
* Add Tracking Code to the Thank You Page
*/
function 161007_checkout_analytics( $order_id ) {
$order = new WC_Order( $order_id );
$currency = $order->get_order_currency();
$total = $order->get_total();
$date = $order->order_date;
?>
<!-- Paste Tracking Code Under Here -->
@DanielSantoro
DanielSantoro / hidebreadcrumb.php
Last active May 19, 2017 23:39
Hide breadcrumb
<?php // Don't include this line, though
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
@DanielSantoro
DanielSantoro / functions.php
Created October 3, 2016 22:36
Remove Storefront Designed by WooThemes from Footer
<?php // Don't include this line
// Remove "Storefront Designed by WooThemes" from Footer
add_action( 'init', 'custom_remove_footer_credit', 10 );
function custom_remove_footer_credit () {
remove_action( 'storefront_footer', 'storefront_credit', 20 );
add_action( 'storefront_footer', 'custom_storefront_credit', 20 );
}
@DanielSantoro
DanielSantoro / functions.php
Created September 19, 2016 01:16
Remove Login Screen Shake
<?php // Don't include this line if you're just adding to your functions.php file
function wps_login_error() {
remove_action('login_head', 'wp_shake_js', 12);
}
add_action('login_head', 'wps_login_error');
@DanielSantoro
DanielSantoro / featured-slider.php
Last active July 29, 2016 17:25
Modified Slider
<div class="block footer-widget-4">
<div id="text-9" class="widget widget_text"><h3>Let’s Stay Connected</h3> <div class="textwidget"><!-- SharpSpring Form for Subscribe Form -->
<script type="text/javascript">
var ss_form = {'account': 'MzQ1MTMyMQQA', 'formID': 'S00yMTSwMEzTNUk1NwISJga6ScnJabqGhimW5ibJqUlJ5ikA'};
ss_form.width = '100%';
ss_form.height = '1000';
ss_form.domain = 'app-OAQRU7SE.marketingautomation.services';
// ss_form.hidden = {'Company': 'Anon'}; // Modify this for sending hidden variables, or overriding values
</script>
<script type="text/javascript" src="https://koi-OAQRU7SE.marketingautomation.services/client/form.js?ver=1.1.1"></script><iframe id="ssf_S00yMTSwMEzTNUk1NwISJga6ScnJabqGhimW5ibJqUlJ5ikA" src="http://app-OAQRU7SE.marketingautomation.services/prospector/form/MzQ1MTMyMQQA/S00yMTSwMEzTNUk1NwISJga6ScnJabqGhimW5ibJqUlJ5ikA?rf__sb=http%3A%2F%2Fpacificnurseries.com%2Fblog-index%2F&amp;_tk=201606|5759ad1572d59c66008b4fd6" style="overflow-y: auto" frameborde