Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
Busy ... Always busy

Mitchell Krog mitchellkrogza

🤓
Busy ... Always busy
View GitHub Profile
@mitchellkrogza
mitchellkrogza / flatsome-customize-woocommerce-notices
Created Aug 16, 2021
Flatsome Theme - Customize Success & Error Messages / Notices (Floating) & Hide Success Messages Completely & Make Notices disappear after 15 seconds
View flatsome-customize-woocommerce-notices
CSS FOR CUSTOMIZING WOOCOMMERCE MESSAGES
/*---------------------------------------------*/
/*Make Woocommerce Messages Float Above Content*/
/*---------------------------------------------*/
.woocommerce-notices-wrapper {
position:fixed;
top:30%;
left:50%;
@mitchellkrogza
mitchellkrogza / woocommerce-hide-featured-image
Created Jul 26, 2021
Woocommerce - hide featured image on single-product page
View woocommerce-hide-featured-image
@mitchellkrogza
mitchellkrogza / wp-rocket-deactivate-cart-fragments-cache
Created Jul 22, 2021
WP Rocket | Deactivate WooCommerce Refresh Cart Fragments Cache
View wp-rocket-deactivate-cart-fragments-cache
/**
* Plugin Name: WP Rocket | Deactivate WooCommerce Refresh Cart Fragments Cache
* Description: Deactivate the WP Rocket feature that caches WooCommerce Refresh Cart Fragments.
* Plugin URI: https://github.com/wp-media/wp-rocket-helpers/tree/master/compatibility/wp-rocket-compat-wc-cart-fragments
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
* Copyright SAS WP MEDIA 2018
View inline flatsome.css (NEW with inline icons) - Flatsome 3.14 Only
add_action('wp_head', 'inject_flatsome', 5);
function inject_flatsome() {
ob_start();
include 'wp-content/themes/flatsome/assets/css/flatsome.css';
$atf_css = ob_get_clean();
if ($atf_css != "" ) {
$theme = wp_get_theme( get_template() );
$version = $theme->get( 'Version' );
$fonts_url = get_template_directory_uri() . '/assets/css/icons';
$atf_css .= '@font-face {
View gist:3227f1b3dc2cb0abc2b6fa0bbb8b600c
<?php
global $product;
$attachment_ids = $product->get_gallery_attachment_ids();
foreach( $attachment_ids as $attachment_id )
{
//Get URL of Gallery Images - default wordpress image sizes
echo $Original_image_url = wp_get_attachment_url( $attachment_id );
echo $full_url = wp_get_attachment_image_src( $attachment_id, 'full' )[0];
echo $medium_url = wp_get_attachment_image_src( $attachment_id, 'medium' )[0];
@mitchellkrogza
mitchellkrogza / woocommerce-backorder-text
Created Jun 14, 2021
Change Woocommerce backorder message text
View woocommerce-backorder-text
// Change backorder message text
function change_backorder_message( $text, $product ){
    if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) {
        $text = __( 'Place your text here', 'woocommerce' );
    }
    return $text;
}
add_filter( 'woocommerce_get_availability_text', 'change_backorder_message', 10, 2 );
@mitchellkrogza
mitchellkrogza / delete-woocommerce-product-images
Created Jun 10, 2021
Delete Woocommerce Product images when deleting a Product
View delete-woocommerce-product-images
add_action( 'before_delete_post', 'delete_product_images', 10, 1 );
function delete_product_images( $post_id )
{
$product = wc_get_product( $post_id );
if ( !$product ) {
return;
}
@mitchellkrogza
mitchellkrogza / WCAdminLastOrderNote
Created Jun 9, 2021 — forked from HookCity/WCAdminLastOrderNote
Add note to Admin mail with latest customer order ID
View WCAdminLastOrderNote
add_action( 'woocommerce_email_order_details', 'las_order_email_order_details', 10, 4 );
function las_order_email_order_details( $order, $sent_to_admin, $plain_text, $email ) {
if($sent_to_admin){
$order_statuses = array('wc-on-hold', 'wc-processing', 'wc-completed');
$customer_user_id = get_current_user_id();
$customer_orders = wc_get_orders( array(
'meta_key' => '_customer_user',
'meta_value' => $customer_user_id,
'post_status' => $order_statuses,
'numberposts' => -1
View disable-woocommerce-blocks-styles-frontend
/**
* Disable WooCommerce block styles (front-end).
*/
function slug_disable_woocommerce_block_styles() {
wp_dequeue_style( 'wc-block-style' );
}
add_action( 'wp_enqueue_scripts', 'slug_disable_woocommerce_block_styles' );
@mitchellkrogza
mitchellkrogza / css-versioning
Created Jun 7, 2021
Add Version Number to theme CSS file
View css-versioning
// Version CSS file in a theme
// Uses a Unix Timestring to Version your CSS Files
wp_enqueue_style(
'theme-styles',
get_stylesheet_directory_uri() . '/style.css',
array(),
filemtime( get_stylesheet_directory() . '/style.css' )
);