Skip to content

Instantly share code, notes, and snippets.

View sirwan's full-sized avatar
🏠
Working from home

Sirwan Qutbi sirwan

🏠
Working from home
View GitHub Profile
@ben-heath
ben-heath / add-to-woocommerce-additional-info-tab-single-product.php
Last active October 13, 2022 16:22
Add content to WooCommerce Additional Information Tab on Single Products
<?php
// This code should be added to the functions.php file of the child theme
// Add custom info to Additional Information product tab
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {
global $product;
$tabs['additional_information']['callback'] = 'custom_function_name'; // this is the function name which is included below
return $tabs;
}
@rayflores
rayflores / logconsole.js
Last active August 22, 2018 21:05
need to log
;( function ( $, window, document, undefined ) {
$( '.composite_data' )
.on( 'wc-composite-initializing', function( event, composite ) {
var l = composite.api;
var step_objects = l.get_steps();
var review_step = l.get_step_by( 'id', 'review' );
var result = $.grep(l, function(e){ return e.id == id; });
//console.log(step_objects);
@psalz
psalz / detect_single_choice_attributes.js
Created April 5, 2016 20:00
Woocommerce Composite Products: Detect single choice attributes
"use strict";
(function ($) {
/**
* Detects all component attributes that have only a single value option and adds the '.single-choice' class
* to the respective table row. Additionally, a <span> with the class '.single-choice-label' is added, containing
* the options name.
*
* If executed twice, the previous changes are reverted first (in order to account for possible scenario changes).
* Default values or previous selections are saved and restored if the option becomes available again.
@kloon
kloon / functions.php
Created September 4, 2013 10:36
WooCommerce Change Description Tab title and heading to product title
<?php
// Change the description tab title to product name
add_filter( 'woocommerce_product_tabs', 'wc_change_product_description_tab_title', 10, 1 );
function wc_change_product_description_tab_title( $tabs ) {
global $post;
if ( isset( $tabs['description']['title'] ) )
$tabs['description']['title'] = $post->post_title;
return $tabs;
}
@EvilScott
EvilScott / image_resizer.rb
Created April 20, 2012 19:54
Image processing server using Sinatra and MiniMagick
require 'mini_magick'
class ImageResizer
attr_accessor :height, :width, :padding, :stretch, :grayscale
def initialize(path)
@image = MiniMagick::Image.open(path)
end