Skip to content

Instantly share code, notes, and snippets.

@tdmrhn
tdmrhn / woo-reorder-checkout-fields.css
Created July 18, 2025 08:23
WooCommerce Reorder checkout fields with CSS
.woocommerce-billing-fields__field-wrapper {
display: grid;
grid-template-columns: repeat(2, 1fr);
row-gap: 1em;
column-gap: 1em;
}
.woocommerce-billing-fields__field-wrapper > .form-row {
width: auto;
}
@tdmrhn
tdmrhn / woo-new-product-filters-off-canvas.css
Created July 14, 2025 11:21
Blocksy 2 Mobile Off Canvas WooCommerce 9.9 New Product Filter Behavior
.wc-block-product-filters .wc-block-product-filters__overlay-dialog {
transform: translateY(0) !important;
pointer-events: auto !important;
}
.wc-block-product-filters .wc-block-product-filters__overlay-header,
.wc-block-product-filters .wc-block-product-filters__open-overlay,
.wc-block-product-filters .wc-block-product-filters__overlay-footer {
display: none !important;
}
@tdmrhn
tdmrhn / blc-2-open-quickview-when-out-of-stock.php
Created May 9, 2025 10:59
Blocksy 2 Change Add to Cart Link with Quickview If Out-of-stock or Backorder
<?php
add_filter( 'woocommerce_loop_add_to_cart_link', function( $link, $product ) {
if ( ! $product->is_in_stock() || $product->is_on_backorder() ) {
return '<button class="ct-open-quick-view ct-button" aria-label="Quick view toggle">Backorder Now</button>';
}
return $link;
}, 10, 2 );
@tdmrhn
tdmrhn / blc-2-show-swatch-tooltip-always.css
Created March 8, 2025 08:42
Bllocksy 2 Always Show Swatch Tooltips
.single-product .ct-swatch-container { flex-direction: column-reverse; gap: 5px; align-items: center}
.single-product .ct-swatch-container .ct-tooltip,
.single-product .ct-swatch-container:hover .ct-tooltip { transform: none; transition: none; position: relative; opacity: 1; visibility: visible; background: transparent; }
.single-product .ct-swatch-container .ct-tooltip:before,
.single-product .ct-swatch-container .ct-tooltip:after { display: none; }
@tdmrhn
tdmrhn / show-only-parent-taxonomy-terms-in-single.php
Created February 16, 2025 11:22
Show only parent taxonomy terms in blog single post
<?php
add_filter('get_the_terms', function($terms, $post_id) {
if (is_single() && get_post_type($post_id) === 'post') {
return array_filter($terms, fn($term) => $term->parent === 0);
}
return $terms;
}, 10, 3);
@tdmrhn
tdmrhn / blc-2-color-switcher.html
Created February 13, 2025 17:37
Blocksy 2 Color Switcher
<button class="ct-color-switch ct-toggle " data-color-switch="reversed" data-label="bottom" aria-label="Color mode switch" data-id="color-mode-switcher">
<span class="ct-label ct-hidden-sm ct-hidden-md" aria-hidden="true">
<span class="ct-dark-mode-label">Dark Mode</span>
<span class="ct-light-mode-label">Light Mode</span>
</span>
</button>
@tdmrhn
tdmrhn / deregister-plugin-scripts-widgets.php
Last active February 19, 2025 09:35
Deregister Plugin Scripts for Widgets
<?php
//
// Godaddy
//
add_action('enqueue_block_editor_assets', function () {
global $wp_customize;
if (! $wp_customize) {
return;
}
@tdmrhn
tdmrhn / blc-2-mobile-full-width-gallery.css
Created February 10, 2025 15:14
Blocksy 2: Mobile Full width Product Gallery
@tdmrhn
tdmrhn / blc-2-disable-all-content-blocks.php
Created December 26, 2024 15:47
Blocksy 2: Disable all Content Blocks
<?php
add_action('init', function() {
$all_content_blocks = get_posts([
'post_type' => 'ct_content_block',
'posts_per_page' => -1,
'post_status' => 'publish',
'fields' => 'ids'
]);
foreach ($all_content_blocks as $block_id) {
@tdmrhn
tdmrhn / blc-2-add-discounted-price-to-sale-badge.php
Created December 2, 2024 10:16
Blocksy 2 add discounted price to sale badge
<?php
add_filter('woocommerce_sale_flash',function ($text, $post, $product) {
if (strpos($text, '<span class="onsale">') === false) {
return $text;
}
if (blocksy_get_theme_mod('sale_badge_value', 'default') === 'custom') {
$text = blocksy_get_theme_mod('sale_badge_custom_value', '-{price}');
if ($product->is_type('variable')) {