Skip to content

Instantly share code, notes, and snippets.

View jhimross's full-sized avatar

Jhimross Olinares jhimross

View GitHub Profile
@jhimross
jhimross / gist:7b7b3c901d523b494c0a1dd22810ff13
Created March 5, 2022 06:13
Change My Account Tab Order
function iconic_woo_my_account_order() {
$myorder = array(
'dashboard' => __( 'Account', 'woocommerce' ),
'edit-account' => __( 'Personal Info', 'woocommerce' ),
'orders' => __( 'Orders', 'woocommerce' ),
'subscriptions' => __( 'Subscriptions', 'woocommerce' ),
'edit-address' => __( 'Address', 'woocommerce' ),
'payment-methods' => __( 'Payment Methods', 'woocommerce' ),
@jhimross
jhimross / gist:07a9174f38348fe15640a4fc9f1d4cd8
Created February 25, 2022 09:56
Fix Linked Variation Displaying in Header When Using Divi theme
/**
* Iconic LV: remove default LV buttons as they are added manually in divi builder.
*
* @return void
*/
function iconic_wlv_remove_default_lv_buttons() {
remove_action( 'woocommerce_single_product_summary', array( 'Iconic_WLV_Product', 'output_linked_variations' ), 25 );
}
add_action( 'init', 'iconic_wlv_remove_default_lv_buttons' );
@jhimross
jhimross / gist:dea7219af703f01952a4e37962962249
Created February 25, 2022 05:43
Add Payment Method in Order Column
add_filter( 'manage_edit-shop_order_columns', 'wps_add_payment_method_column', 20 );
/**
* Add payment method column
*/
function wps_add_payment_method_column( $columns ) {
$new_columns = array();
foreach ( $columns as $column_name => $column_info ) {
@jhimross
jhimross / gist:018709bb4024aa09850b42f8724fa399
Created February 24, 2022 17:13
Hide Cart Icon When Cart is Empty
add_action( 'wp_footer', function() {
if ( WC()->cart->is_empty() ) {
echo '<style type="text/css">CLASS HERE{ display: none; }</style>';
}
});
@jhimross
jhimross / gist:3c8f50f67503af0cb0fe6e7027bf8baa
Created January 28, 2022 03:54
Orderable - Change "Today" and "Tomorrow" label in the checkout
/**
* Orderable.
* Modify 'Today' label.
*
*/
function change_delivery_today_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Today' :
$translated_text = __( 'Add Text Here', 'woocommerce' );
break;
@jhimross
jhimross / gist:0bfa2a6bd8c3be591a92c893b0e4d6d3
Created January 27, 2022 04:55
WooThumbs - Fix Flatsome Flickity Conflict
/**
*Iconic Attributes Swatches - dequeue flickity JS and CSS
*/
function iconic_was_dequeue_flickity(){
wp_dequeue_style( 'flickity' );
wp_dequeue_script( 'flickity' );
}
add_action( 'wp_enqueue_scripts','iconic_was_dequeue_flickity', 11);
@jhimross
jhimross / gist:5b674f2f21a6de702f0b30fecb35250f
Created January 27, 2022 04:54
WooCommerce Show Single Variations - Show Parent Product Description in Variations
/**
* Show parent's short description for variations.
*
* @param string $excerpt
* @param $post
*
* @return string
*/
function iconic_get_the_excerpt( $excerpt, $post ) {
if ( 'product_variation' !== $post->post_type ) {
@jhimross
jhimross / gist:ed8a7392bab37ecf673adb598787a599
Created January 27, 2022 04:52
WooCommerce Delivery Slots - Change "ASAP" Text
/**
* Iconic WDS.
* Modify 'ASAP' label.
*
* @param string $label Label.
*
* @return string
*/
function iconic_wds_modify_asap_label( $label ) {
return 'As soon as possible'; // Change this value
@jhimross
jhimross / gist:51c1be7ebba3af069d983bf6b17f7950
Created January 27, 2022 04:51
WooCommerce Linked Variations - Add Linked Variations Swatches in the Catalog/Shop
// Add Iconic linked products to shop page
add_filter('woocommerce_loop_add_to_cart_link', 'wlv_add_swatch', 999);
function wlv_add_swatch() {
echo do_shortcode('[iconic_wlv_links]');
}
@jhimross
jhimross / gist:1510a2dcd5aea169bc8d98077bf19691
Created January 27, 2022 04:49
WooThumbs - Show Media Controls
jQuery('.iconic-woothumbs-responsive-media video').attr('controls',true);