Skip to content

Instantly share code, notes, and snippets.

View heymicoo's full-sized avatar

Michael Bryan Reyes heymicoo

View GitHub Profile
@qzya
qzya / sorting_in_variations_dropdown.php
Created March 30, 2022 22:38
[Sort product attributes in variations dropdown on single page by backend variations order ] #wp #woocommerce #products #product_attributes #sorting #terms #variations
<?php
add_filter('woocommerce_dropdown_variation_attribute_options_html', 'wc_dropdown_variation_attribute_options_sorted', 20, 2);
function wc_dropdown_variation_attribute_options_sorted( $html, $args ) {
$args = wp_parse_args(
apply_filters( 'woocommerce_dropdown_variation_attribute_options_args', $args ),
array(
'options' => false,
'attribute' => false,
'product' => false,
@webhasan
webhasan / ajax-add-to-cart.js
Created January 30, 2020 12:52
WooCommerce Single Page Ajax Add To Cart.
/* global wc_add_to_cart_params */
(function($) {
$(function() {
if ( typeof wc_add_to_cart_params === 'undefined' ) {
return false;
}
$('.entry-summary form.cart').on('submit', function (e) {
@tradesouthwest
tradesouthwest / wp-search-filter-ajax.php
Created January 7, 2018 20:32
wordpress filter for searching categories with ajax
<form action="<?php echo site_url() ?>/wp-admin/admin-ajax.php" method="POST" id="filter">
<?php
if( $terms = get_terms( 'category', 'orderby=name' ) ) :
echo '<select name="categoryfilter"><option>Select category...</option>';
foreach ( $terms as $term ) :
echo '<option value="' . $term->term_id . '">' . $term->name . '</option>';
endforeach;
echo '</select>';
endif;
@mariovalney
mariovalney / woo-enable-reviews-bulk-edit.php
Created August 7, 2017 19:55
WooCommerce Enable Reviews - Bulk Edit
<?php
/**
*
* Plugin Name: WooCommerce Enable Reviews - Bulk Edit
* Description: Allow enable reviews by bulk edit into WooCommerce
* Version: 1.0.0
* Author: Mário Valney
* Author URI: http://mariovalney.com
* Text Domain: woo-enable-reviews-bulk-edit
*
@subharanjanm
subharanjanm / deactivate-plugins-wpe-staging.php
Last active March 19, 2024 19:09
Deactivate certain plugins in the development/staging environment of WP Engine
<?php
/*
Plugin Name: Deactivate Certain Plugins - WPEngine Staging
Plugin URI: https://gist.github.com/subharanjanm/4272d25a446fb2ca12a549a4a5662633
Description: Deactivate certain plugins in the development/staging environment of WP Engine.
Version: 1.0
Author: Subharanjan
Author URI: https://gist.github.com/subharanjanm/4272d25a446fb2ca12a549a4a5662633
License: GPLv2
*/
@mikejolley
mikejolley / gist:3969579
Created October 28, 2012 19:28
WooCommerce - Create a coupon via PHP
$coupon_code = 'UNIQUECODE'; // Code
$amount = '10'; // Amount
$discount_type = 'fixed_cart'; // Type: fixed_cart, percent, fixed_product, percent_product
$coupon = array(
'post_title' => $coupon_code,
'post_content' => '',
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'shop_coupon'