Skip to content

Instantly share code, notes, and snippets.

@Sanabria
Sanabria / functions.php
Created October 27, 2021 04:47 — forked from kloon/functions.php
WooCommerce 3.2: Add resend admin order email option that was removed
<?php
/**
* This adds back an option to resend the admin new order email from the order edit screen that was removed in WooCommerce 3.2
*/
/**
* Filter to add a new menu to the dropdown
*
* @param array $actions
* @return array
@Sanabria
Sanabria / loop-products-woocommerce.php
Created July 30, 2021 23:30 — forked from eliasfaical/loop-products-woocommerce.php
Sample products loop - Woocommerce
<ul class="products">
<?php
$args = array( 'post_type' => 'product', 'posts_per_page' => 1, 'product_cat' => 'camisa' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
<h2>Shoes</h2>
<li class="product">
<a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>">
<?php
woocommerce_show_product_sale_flash( $post, $product );
@Sanabria
Sanabria / woocommerce_simple_add_to_cart.js
Created June 16, 2021 22:44 — forked from mircian/woocommerce_simple_add_to_cart.js
Create a simple function which you can globally call to easily add a product to the cart by id.
<script type="text/javascript">
function m_wc_add_to_cart( product_id ) {
if ( 'undefined' === typeof wc_add_to_cart_params ) {
// The add to cart params are not present.
return false;
}
var data = {
product_id: product_id,
@Sanabria
Sanabria / hooks.php
Created June 16, 2021 21:46 — forked from ashokmhrj/hooks.php
WooCommerce mnicart qty update
<?php
add_action('woocommerce_widget_shopping_cart_before_buttons','ask_woo_mini_cart_before_buttons' );
function ask_woo_mini_cart_before_buttons(){
wp_nonce_field( 'woocommerce-cart' );
?>
<div class="submit-button">
<input type="submit" class="button" name="update_cart" value="<?php esc_attr_e('Uppdatera varukorg', 'tidymerch'); ?>"/>
</div>
<?php
@Sanabria
Sanabria / .gitignore
Created June 14, 2021 20:18 — forked from lumpysimon/.gitignore
A .gitignore file for WordPress that ignores pretty much everything except for the specified plugin(s), theme(s) and mu-plugins folder
# .gitignore file for WordPress that ignores everything except:
#
# - .gitignore
# - favicon.ico
# - wp-config.php
# - everything in mu-plugins
# - my-plugin
# - my-theme (except for .sass-cache)
#
# based on https://gist.github.com/jdbartlett/444295
@Sanabria
Sanabria / woocommerce-sage-template-part-overrides.md
Created June 9, 2021 19:53 — forked from drawcard/woocommerce-sage-template-part-overrides.md
Woocommerce - Using template part overrides in Sage

So, you know how to override a template file in Woocommerce using Sage, but you're having trouble changing something within the deeper level of that template file. For example, you want to change the output HTML structure of a given part of the product page loop, or incorporate a Bootstrap class into a button element without using Jquery to inject it. Here's how you can override deeper level parts, the default WC theme elements.

Prerequisites

Now you're familiar with how to do Sage + Woocommerce templates, it's time to make it happen.

The template page override

Stop the MySQL Service

I'm using Homebrew to stop the service

brew services stop mysql

Locate MySQL Data Directory

@Sanabria
Sanabria / .htaccess
Created June 8, 2021 15:12 — forked from fitorec/.htaccess
Un simple .htaccess para wordpress
AddHandler x-httpd-php5 .php
#########################################################################
# Wordpress Base #
#########################################################################
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
@Sanabria
Sanabria / Bootstrap4Nav-Sage9.md
Created April 28, 2021 17:07 — forked from smutek/Bootstrap4Nav-Sage9.md
Bootstrap 4 Walker for Sage 9

Credit

This is a frankensteind version of the current Soil nav walker, by the Roots team, and Michael Remoero's Sagextras walker. All credit goes to those good folks. :)

Use

  • Replace the contents of header.blade.php with the attached header.
  • Copy the walker.php file to the /app directory.
  • Add walker.php to the Sage required files array in resources/functions.php - eg. on a stock Sage install the entry would look like:
/**
@Sanabria
Sanabria / replace-woocommerce-lightbox-with-lightgallery.php
Created January 12, 2021 04:30 — forked from carasmo/replace-woocommerce-lightbox-with-lightgallery.php
Replace PhotoSwipe Lightbox in WooCommerce with your own, as long as your own is LightGallery (https://github.com/sachinchoolur/lightGallery). Assumes that you've registered your js. Pardon the formatting, it got weird on me.
<?php
//don't add again
// assumes that you have registered your js for the new lightbox and that you understand what a handle is.
// Gallery Support
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-slider' );