Skip to content

Instantly share code, notes, and snippets.

@jmabbas
jmabbas / functions.php
Last active October 21, 2026 06:44
Electro - Mobile page category block order update
add_filter( 'electro_home_mobile_v1_categories_block_args', function( $args ) {
$meta = electro_get_home_mobile_v1_meta();
if ( ! empty( $meta['hcb']['cat_slugs'] ) ) {
$slug_order = array_map( 'trim', explode( ',', $meta['hcb']['cat_slugs'] ) );
// Convert slugs to IDs so WordPress fetches only these categories
$term_ids = array();
foreach ( $slug_order as $slug ) {
$term = get_term_by( 'slug', $slug, 'product_cat' );
@jmabbas
jmabbas / style.css
Created October 20, 2026 06:50
Electro - Mobile cart apply pay button
@media (max-width: 575.98px) {
table.shop_table.shop_table_responsive.cart .wc-proceed-to-checkout,
table.shop_table.shop_table_responsive.cart .wc-proceed-to-checkout a {
display: block;
}
.cart-collaterals .wc-proceed-to-checkout {
display: none;
}
}
@jmabbas
jmabbas / functions.php
Created October 19, 2026 07:25
StoreBolt - Change popular right now products
use MadrasThemes\WCAdvancedSearch\Support\PopularProducts;
add_filter( 'maswcas_popular_products', function( $cards, $limit ) {
if ( ! class_exists( '\MadrasThemes\WCAdvancedSearch\Support\PopularProducts' ) || ! function_exists( 'wc_get_product' ) ) {
return $cards;
}
$custom_product_ids = array( 2930, 2926, 2860 );
$now = function_exists( 'current_time' ) ? (int) current_time( 'timestamp', true ) : time();
$custom_cards = array();
@jmabbas
jmabbas / functions.php
Created October 13, 2026 08:48
Electro - Single product custom download button
/**
* 1. Add custom Download Link and Button Text fields on single product edit page.
*/
add_action( 'woocommerce_product_options_general_product_data', 'ec_child_add_download_button_fields' );
function ec_child_add_download_button_fields() {
echo '<div class="options_group">';
woocommerce_wp_text_input(
array(
@jmabbas
jmabbas / functions.php
Last active October 8, 2026 12:30
GoTrek - Search box input update
// 1. Ensure search query variables are registered
add_filter( 'query_vars', function( $vars ) {
$vars[] = 'location';
$vars[] = 'adults';
$vars[] = 'children';
$vars[] = 'rooms';
return $vars;
} );
// 2. Hook into the main WooCommerce product query
@jmabbas
jmabbas / style.css
Last active October 1, 2026 05:00
Electro - Remove rating count on loop products
.owl-item>.product .product-loop-body .product-rating > div,
.products>.product .product-loop-body .product-rating > div {
font-size: 12px;
margin-bottom: 10px;
}
.owl-item>.product .product-loop-body .product-rating,
.products>.product .product-loop-body .product-rating {
font-size: 0;
}
@jmabbas
jmabbas / functions.php
Last active September 23, 2026 12:04
GoTrek - Search box update as per input count
/**
* --------------------------------------------------------------------------
* GoTrek: Dynamic Hotel Filter by Location, Adults, and Children
* --------------------------------------------------------------------------
*/
// 1. Output hotel data attributes inside each product item in the loop
add_action( 'woocommerce_before_shop_loop_item', 'gotrek_output_hotel_filter_meta', 1 );
add_action( 'woocommerce_shop_loop_item_title', 'gotrek_output_hotel_filter_meta', 1 );
@jmabbas
jmabbas / functions.php
Created September 10, 2026 07:16
GoTrek - Single product Maps URL
function gotrek_single_hotel_show_map() {
if ( ! gotrek_is_acf_activated() ) {
return;
}
$hotel_group = gotrek_get_hotel_group();
if ( ! empty( $hotel_group['location_map'] ) ) :
$map_url = '';
if ( is_array( $hotel_group['location_map'] ) ) {
if ( ! empty( $hotel_group['location_map']['address'] ) ) {
@jmabbas
jmabbas / style.css
Created August 25, 2026 05:52
Cartzilla - Amazon pay
div#amazon_customer_details .col2-set > div {
max-width: 100%;
background-color: #fff;
padding: 20px;
}
@jmabbas
jmabbas / style.css
Created August 24, 2026 06:46
FreshCart - Password reset.
.woocommerce-account:not(.logged-in).woocommerce-lost-password .woocommerce {
display: flex;
flex-direction: column;
}
.woocommerce-account:not(.logged-in).woocommerce-lost-password .woocommerce::before,
.woocommerce-account:not(.logged-in).woocommerce-lost-password .wc-block-components-notice-banner.is-success {
width:100%;
}