Skip to content

Instantly share code, notes, and snippets.

View ahmedeshaan's full-sized avatar

Ahmed Eshaan ahmedeshaan

View GitHub Profile
add_action( 'woocommerce_add_order_item_meta', 'flatsome_add_sku_order_details', 10, 3 );
function flatsome_add_sku_order_details( $item_id, $values, $cart_item_key ) {
$item_sku = get_post_meta( $values[ 'product_id' ], '_sku', true );
wc_add_order_item_meta( $item_id, 'sku', $item_sku , false );
}
<script type="text/javascript">
jQuery(function($){
$('.menu-item.has-child').each(function(){
$(this).addClass('active');
});
});
<script>
jQuery(document).ready(function ($) {
function removeLoader() {
$('.product-type-external').find('.single_add_to_cart_button').removeClass('loading');
}
$('.product-type-external').find('.single_add_to_cart_button').attr("target", "_blank");
$('.product-type-external').find('.single_add_to_cart_button').on("click", removeLoader);
});
</script>
<?php
add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
$html .= woocommerce_quantity_input( array(), $product, false );
$html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
$html .= '</form>';
}
<?php
add_action( 'init','custom_remove_breadcrumb' ); function
custom_remove_breadcrumb()
{ remove_action('flatsome_category_title','flatsome_shop_loop_tools_breadcrumbs',10); }
/*
Theme Name: Flatsome Child
Description: This is a child theme for Flatsome Theme
Author: UX Themes
Template: flatsome
Version: 3.0
*/
/*************** ADD CUSTOM CSS HERE. ***************/
#map_go {width:100%!important;}
.woo-variation-swatches-theme-ux-shop .variations .select2-container {
display:none;
}
<?php
function custom_woocommerce_tag_cloud_widget() {
$args = array(
'number' => 15,
'taxonomy' => 'product_tag'
);
return $args;
}
add_filter( 'woocommerce_product_tag_cloud_widget_args', 'custom_woocommerce_tag_cloud_widget' );
* Bypass logout confirmation.
*/
function iconic_bypass_logout_confirmation() {
global $wp;
if ( isset( $wp->query_vars['customer-logout'] ) ) {
wp_redirect( str_replace( '&amp;', '&', wp_logout_url( wc_get_page_permalink( 'disconnected' ) ) ) );
exit;
}
}
https://www.majemedia.com/2015/01/woocommerce-how-to-show-empty-categories/