This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add GTIN Field to WooCommerce Quick Edit Panel | |
| * | |
| * Allows viewing and editing GTIN from the Quick Edit dropdown. | |
| */ | |
| /** | |
| * Get the GTIN field label (same as product settings). | |
| * | |
| * @return string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add GTIN Column to WooCommerce Products List Table | |
| * | |
| * Adds a sortable, searchable GTIN column to Products > All Products. | |
| */ | |
| // Add GTIN column to products list (positioned after SKU). | |
| add_filter( 'manage_edit-product_columns', function( $columns ) { | |
| // Find SKU position and insert after it. | |
| $sku_position = array_search( 'sku', array_keys( $columns ), true ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Disable Min/Max "Group of" quantity rules for bundled products. | |
| * This allows bundled items to have a quantity of 1 even when the | |
| * standalone product has a "Group of 6" rule. | |
| * | |
| * @author Shameem Reza | |
| */ | |
| // Product Bundles side - disable Group of for bundled item calculations. | |
| add_filter( 'woocommerce_bundled_item_group_of_quantity', '__return_zero', 999 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Hide variations for specific products when using Variations as Single Products plugin | |
| * Add product slugs to the $target_products array below | |
| */ | |
| add_filter( 'posts_clauses', 'vaspfw_hide_specific_variations', 99998, 2 ); | |
| function vaspfw_hide_specific_variations( $clauses, $query ) { | |
| global $wpdb; | |
| // Only apply to variation queries | |
| if ( ! isset( $query->query_vars['vaspfw_single_variation_filter'] ) || |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add US tariff surcharge to shipping costs. | |
| * | |
| * Custom implementation to apply US tariffs on shipping charges | |
| * to work alongside the WooCommerce Customs Fees plugin. | |
| * | |
| * @since 1.0.0 | |
| * @author Shameem Reza | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add this code to your theme's functions.php file | |
| * or use a code snippets plugin | |
| * | |
| * This fixes the currency symbol positioning for WooCommerce on RTL sites | |
| */ | |
| // Fix WooCommerce currency position for RTL sites | |
| add_filter( 'woocommerce_price_format', function( $format, $currency_pos ) { | |
| // Only apply to RTL sites with ILS currency |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Fix for Product Add-ons bypassing Sold individually setting | |
| * Add this to the theme's functions.php or as a custom plugin | |
| */ | |
| add_filter( 'woocommerce_add_to_cart_validation', 'enforce_sold_individually_with_addons', 999, 5 ); | |
| function enforce_sold_individually_with_addons( $passed, $product_id, $quantity, $variation_id = 0, $variations = array() ) { | |
| // Get the product | |
| $product = wc_get_product( $variation_id ? $variation_id : $product_id ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Reset variation selections after successful add to cart | |
| */ | |
| add_action( 'wp_footer', function() { | |
| if ( ! is_product() ) { | |
| return; | |
| } | |
| ?> | |
| <script type="text/javascript"> | |
| jQuery(document).ready(function($) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('woocommerce_product_add_to_cart_text', function($text, $product) { | |
| if ($product->get_type() === 'booking') { | |
| return __('Add to Cart', 'woocommerce'); | |
| } | |
| return $text; | |
| }, 10, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Hide zero-priced downloadable products from subscription line items. | |
| */ | |
| function wcsd_hide_zero_priced_downloads() { | |
| // Filter the line items display only, not affecting the actual data. | |
| add_filter( 'woocommerce_order_get_items', 'wcsd_filter_subscription_items', 10, 3 ); | |
| // IMPORTANT: We're NOT removing the original download_permissions action | |
| // so download permissions are still properly granted. | |
| } |
NewerOlder