Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Fisher MrJoshFisher

View GitHub Profile
View [OLD]-set_product_category_base_same_shop_base.php
<?php
/*This old code*/
add_filter( 'rewrite_rules_array', function( $rules )
{
$new_rules = array();
$terms = get_terms( array(
'taxonomy' => 'product_cat',
'post_type' => 'product',
'hide_empty' => false,
));
@MrJoshFisher
MrJoshFisher / functions.php
Created Jul 22, 2017 — forked from srikat/functions.php
Adding a cart icon with number of items and total cost in nav menu when using WooCommerce. http://sridharkatakam.com/adding-cart-icon-number-items-total-cost-nav-menu-using-woocommerce/
View functions.php
//* Make Font Awesome available
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css' );
}
/**
* Place a cart icon with number of items and total cost in the menu bar.
@MrJoshFisher
MrJoshFisher / Show RRP Price & Sale Price In Cart
Created Jul 17, 2017
Shows the RRP Price / Sale Price on the cart page in the table.
View Show RRP Price & Sale Price In Cart
add_filter( 'woocommerce_cart_item_price', 'bbloomer_change_cart_table_price_display', 30, 3 );
function bbloomer_change_cart_table_price_display( $price, $values, $cart_item_key ) {
$slashed_price = $values['data']->get_price_html();
$is_on_sale = $values['data']->is_on_sale();
if ( $is_on_sale ) {
$price = $slashed_price;
}
return $price;
}
@MrJoshFisher
MrJoshFisher / Came From Page.php
Created Jul 17, 2017
Wordpress function to check if the user came from a specific page and if they did run a function.
View Came From Page.php
<?php
if(is_cart()){
$icamefrom = $_SERVER["HTTP_REFERER"];
if ($icamefrom == 'https://www.americanhempoil.net/aho-trial/') {
cartofferpage();
}
}
?>
View class_fb_backlink_checker.php
@MrJoshFisher
MrJoshFisher / Addto.phtml
Last active Aug 29, 2015
Magneto Disable Shopping Cart With Attribute
View Addto.phtml
<?php
//Checks if the "Disable Add to Cart" variable is set to 'Yes':
if(($_product->getAttributeText('no_sample_button')) == "Yes"){
//If set to Yes, tell PHP what to output:
} else {
?>
You can’t perform that action at this time.